Shell

jiki includes a shell that supports pipes, logical operators, glob patterns, variable expansion, command history, tab completion, and background jobs.

Built-in commands

CommandDescription
lsList directory contents
catDisplay file contents
cdChange working directory
pwdPrint working directory
mkdirCreate directories
rmRemove files and directories
echoPrint text to stdout
exportSet environment variables
historyShow command history
jobsList background jobs
fgBring a background job to foreground

Shell operators

  • | — redirect stdout of one command to stdin of the next
  • && — run the next command only if the previous one succeeds
  • || — run the next command only if the previous one fails
  • ; — run commands sequentially regardless of exit status
  • & — run command in the background
  • > / >> — redirect stdout to a file (overwrite / append)

Glob patterns

  • *.js — match files with .js extension
  • **/*.ts — recursive match across nested directories
  • ? — match a single character
  • {a,b} — brace expansion (*.{js,ts} matches both extensions)

Command history

Commands are automatically recorded. Use shell.history to navigate:

shell.history.up(); // previous command
shell.history.down(); // next command
shell.history.getAll(); // all commands

Tab completion

const candidates = shell.complete("ec");
// ['echo'] — matches commands, .bin/ binaries, and file paths

Usage

const result = await container.run("echo hello && echo world");