gbash

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

curl is 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                                     # UTC

echo

Display a line of text.

echo "hello world"
echo -n "no newline"
echo -e "line1\nline2"                      # interpret escapes

env

Run a command in a modified environment or print environment variables.

env
env FOO=bar command

expr

Evaluate expressions.

expr 2 + 3                                  # 5
expr length "hello"                         # 5

false

Exit with a failure (non-zero) status.

false || echo "failed"

help

Display help for built-in commands.

help
help grep

id

Print real and effective user and group IDs.

id

md5sum

Compute and check MD5 message digests.

md5sum file.txt
echo -n "hello" | md5sum

printenv

Print all or part of the environment.

printenv
printenv HOME

pwd

Print the current working directory.

pwd

sha1sum

Compute SHA-1 message digests.

sha1sum file.txt
echo -n "hello" | sha1sum

sha256sum

Compute SHA-256 message digests.

sha256sum file.txt
echo -n "hello" | sha256sum

sleep

Delay for a specified amount of time.

sleep 1
sleep 0.5

timeout

Run a command with a time limit.

timeout 5 long-running-command

true

Exit with a success (zero) status.

true && echo "ok"

uptime

Show how long the system has been running.

uptime

which

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 echo

yes

Repeatedly output a string until killed or piped.

yes | head -n 5
yes "agree" | head -n 3

Session and Shell Helpers

The default runtime also exposes a few session-oriented helpers and shell-condition commands:

CommandDescription
historyPrint the current interactive session history
completeRegister programmable completion handlers
compoptAdjust completion behavior for the current completion spec
testEvaluate 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:

CommandDescription
archPrint the sandbox machine architecture
b2sumCompute BLAKE2 checksums
cksumCompute POSIX CRC checksums
clearClear the terminal display
dircolorsEmit shell code for colorized directory listings
factorPrint the prime factors of integers
groupsPrint the current user's group memberships
hostidPrint the sandbox host identifier
hostnamePrint the sandbox host name
killSend signals to shell-managed jobs or PIDs
lognamePrint the login name
nohupRun a command with hangup ignored
nprocPrint the available processor count
pinkyPrint a compact user information report
sha224sumCompute SHA-224 message digests
sha384sumCompute SHA-384 message digests
sha512sumCompute SHA-512 message digests
sumCompute historical BSD/System V checksums
ttyPrint the terminal device name
unamePrint sandbox system information
usersPrint logged-in user names
whoShow logged-in session records
whoamiPrint the effective user name

For flags and shell-facing help text, run help <command> inside gbash.