gbash

Commands

gbash ships with a large default registry of file, text, archive, and system commands. That registry-backed surface is complemented by shell builtins handled by the in-tree shell core.

Unknown commands never fall through to host binaries. If a name is not registered or implemented by the shell engine, it fails with a normal shell-style error instead of executing anything on the host.

The built-in set targets GNU coreutils flag parity where practical. See the compatibility report for current coverage.

Default Registry

Call DefaultRegistry() to get the stock command set:

registry := gbash.DefaultRegistry()
 
gb, err := gbash.New(gbash.WithRegistry(registry))

You can also register additional commands on top of the default set (see Contrib Commands and the custom-zstd example).

Command Reference

File and Path

CommandDescription
basenameStrip directory and suffix from a filename
catConcatenate and print files
chmodChange file mode bits
chgrpChange file group ownership
chownChange file owner and group
cpCopy files and directories
ddCopy and transform data streams
dfReport filesystem space usage
dirList directory contents (ls-style)
dirnameStrip the last component from a path
duEstimate file space usage
fileDetermine file type
findSearch for files in a directory hierarchy
installCopy files and set permissions in one step
linkCreate a hard link
lnCreate symbolic links
lsList directory contents
mkdirCreate directories
mktempCreate temporary files and directories
mvMove or rename files
pathchkValidate path names for portability and safety
readlinkPrint the target of a symbolic link
realpathResolve a path to its canonical absolute form
rmRemove files or directories
rmdirRemove empty directories
statDisplay file status
touchChange file timestamps or create empty files
treeList directory contents in a tree format
truncateShrink or extend files to a target size
unlinkRemove a single directory entry
vdirVerbose directory listing (ls -l style)

See File and Path for details.

Search and Text Processing

CommandDescription
base32Base32 encode/decode
base64Base64 encode/decode
basencEncode/decode using multiple base encodings
columnFormat input into columns
commCompare two sorted files line by line
csplitSplit a file by context or regex boundaries
cutRemove sections from each line
diffCompare files line by line
egrepgrep alias optimized for extended regex syntax
expandConvert tabs to spaces
fgrepgrep alias for fixed-string matching
foldWrap long lines to a fixed width
fmtReflow plain text paragraphs
grepSearch for patterns in files
headOutput the first part of files
joinJoin lines of two files on a common field
nlNumber lines of files
numfmtReformat numbers into human-readable or raw forms
odDump files in octal, hex, or other formats
pasteMerge lines of files
prPaginate text for printing
printfFormat and print data
ptxBuild permuted indexes for text
revReverse lines character-wise
sedStream editor for filtering and transforming text
seqPrint a sequence of numbers
shufRandomize input lines
sortSort lines of text files
splitSplit a file into pieces
stringsExtract printable strings from binary data
tacConcatenate and print files in reverse
tailOutput the last part of files
teeRead from stdin and write to stdout and files
trTranslate or delete characters
tsortTopologically sort dependency pairs
unexpandConvert spaces back to tabs
uniqReport or omit repeated lines
wcPrint newline, word, and byte counts
xanCSV toolkit for row, column, aggregation, reshape, and conversion operations

See Search and Text Processing for details.

Archive and Compression

CommandDescription
gzipCompress files
gunzipDecompress gzip files
tarArchive files
zcatView compressed files

See Archive and Compression for details.

Environment and Execution

CommandDescription
archReport the sandbox architecture
b2sumCompute BLAKE2 checksums
bashExecute a bash sub-shell inside the sandbox
cksumCompute POSIX CRC checksums
clearClear the terminal display
curlTransfer data from URLs (when network is configured)
dateDisplay or set the date and time
dircolorsEmit shell code for colorized directory listings
echoDisplay a line of text
envRun a command in a modified environment
exprEvaluate expressions
factorPrint prime factors
falseExit with failure status
groupsPrint group memberships
helpDisplay help for built-in commands
hostidPrint the sandbox host identifier
hostnamePrint the sandbox hostname
idPrint user identity
killSend signals to shell-managed jobs or PIDs
lognamePrint the login name
md5sumCompute MD5 message digests
nohupRun a command with hangup ignored
nprocPrint the available processor count
pinkyLightweight user information report
printenvPrint environment variables
pwdPrint working directory
shExecute a shell sub-shell inside the sandbox
sha1sumCompute SHA-1 digests
sha224sumCompute SHA-224 digests
sha256sumCompute SHA-256 digests
sha384sumCompute SHA-384 digests
sha512sumCompute SHA-512 digests
sleepDelay for a specified time
sumCompute historical BSD/System V checksums
timeoutRun a command with a time limit
trueExit with success status
ttyPrint the terminal name
unamePrint sandbox system information
uptimeShow how long the system has been running
usersPrint logged-in users
whichLocate a command in the registry
whoShow logged-in session records
whoamiPrint the effective user name
xargsBuild and execute command lines from stdin
yesRepeatedly output a string

See Environment and Execution for details.

Shell Builtins and Session Helpers

The shell engine also exposes builtins and shims such as ., :, [, alias, cd, command, complete, compopt, declare, dirs, eval, exec, exit, export, getopts, history, let, local, mapfile, popd, pushd, read, readarray, readonly, return, set, shift, shopt, source, test, trap, type, typeset, unalias, unset, and wait.

Those names stay inside the gbash runtime as well. They do not resolve to host binaries.

Contrib (Optional)

CommandDescription
awkPattern scanning and processing (via goawk)
html-to-markdownHTML to Markdown converter (via html-to-markdown)
jqJSON processor (via gojq)
sqlite3SQLite database shell (via go-sqlite3)
yqYAML/JSON/XML processor (via yq)

See Contrib Commands for details.