Environment and System Commands
Commands for shell control, environment inspection, hashing, and process management.
bash
Execute a command in a bash sub-shell.
bash -c 'echo "hello from subshell"'sh
Execute a command in a shell sub-shell. Behaves the same as bash within the sandbox.
sh -c 'echo "hello"'curl
Transfer data from URLs. Only available when network access is configured via WithHTTPAccess, WithNetwork, or WithNetworkClient.
curl https://api.example.com/data
curl -s -o output.json https://api.example.com/data
curl -X POST -d '{"key":"value"}' https://api.example.com/submit
curlis automatically registered when the runtime has a network policy. It is not part of the default registry.
date
Display the date and time.
date
date +%Y-%m-%d
date -u # UTCecho
Display a line of text.
echo "hello world"
echo -n "no newline"
echo -e "line1\nline2" # interpret escapesenv
Run a command in a modified environment or print environment variables.
env
env FOO=bar commandexpr
Evaluate expressions.
expr 2 + 3 # 5
expr length "hello" # 5false
Exit with a failure (non-zero) status.
false || echo "failed"help
Display help for built-in commands.
help
help grepid
Print real and effective user and group IDs.
idmd5sum
Compute and check MD5 message digests.
md5sum file.txt
echo -n "hello" | md5sumprintenv
Print all or part of the environment.
printenv
printenv HOMEpwd
Print the current working directory.
pwdsha1sum
Compute SHA-1 message digests.
sha1sum file.txt
echo -n "hello" | sha1sumsha256sum
Compute SHA-256 message digests.
sha256sum file.txt
echo -n "hello" | sha256sumsleep
Delay for a specified amount of time.
sleep 1
sleep 0.5timeout
Run a command with a time limit.
timeout 5 long-running-commandtrue
Exit with a success (zero) status.
true && echo "ok"uptime
Show how long the system has been running.
uptimewhich
Locate a command in the registry. Returns success if the command is registered, failure otherwise.
which grep
which nonexistent || echo "not found"xargs
Build and execute command lines from standard input.
find . -name "*.txt" | xargs wc -l
echo "a b c" | xargs -n1 echoyes
Repeatedly output a string until killed or piped.
yes | head -n 5
yes "agree" | head -n 3Session and Shell Helpers
The default runtime also exposes a few session-oriented helpers and shell-condition commands:
| Command | Description |
|---|---|
history | Print the current interactive session history |
complete | Register programmable completion handlers |
compopt | Adjust completion behavior for the current completion spec |
test | Evaluate shell conditions |
[ | Alternate test syntax that must end with ] |
Most other shell builtins such as cd, source, eval, pushd, popd, type, and trap are provided by the shell engine itself rather than by the registry.
Additional Environment and System Utilities
These commands are also part of the default registry:
| Command | Description |
|---|---|
arch | Print the sandbox machine architecture |
b2sum | Compute BLAKE2 checksums |
cksum | Compute POSIX CRC checksums |
clear | Clear the terminal display |
dircolors | Emit shell code for colorized directory listings |
factor | Print the prime factors of integers |
groups | Print the current user's group memberships |
hostid | Print the sandbox host identifier |
hostname | Print the sandbox host name |
kill | Send signals to shell-managed jobs or PIDs |
logname | Print the login name |
nohup | Run a command with hangup ignored |
nproc | Print the available processor count |
pinky | Print a compact user information report |
sha224sum | Compute SHA-224 message digests |
sha384sum | Compute SHA-384 message digests |
sha512sum | Compute SHA-512 message digests |
sum | Compute historical BSD/System V checksums |
tty | Print the terminal device name |
uname | Print sandbox system information |
users | Print logged-in user names |
who | Show logged-in session records |
whoami | Print the effective user name |
For flags and shell-facing help text, run help <command> inside gbash.