go-bash-wasm is a high-fidelity, clean-room simulator of the GNU Bash shell and Coreutils, written in Go and optimized for WebAssembly (WASM). It brings the power of a standard UNIX environment to sandboxed ecosystems like browsers, edge computing, and secure server-side runtimes.
ls with support for nearly all standard flags).GOOS=js GOARCH=wasm for in-browser execution.afero for a fully detached, in-memory filesystem hierarchy.zerolog for high-performance, structured logging (native) and clean browser console output.The project follows a clean, modular architecture:
cmd/go-bash-wasm/: Entry points for execution.main.go: Native Go CLI entry point.main_js.go: WebAssembly entry point using syscall/js.internal/: Core shell and command implementations.internal/shell: REPL and command execution logic.internal/commands: High-parity utilities (ls, cat, grep, etc.).ui/: Modern Svelte 5 frontend with xterm.js integration.ui.Dockerfile: Production-ready multi-stage build for the browser environment (includes wasm-opt).Dockerfile: CLI-focused environment using the wasip1/wasm target and Wasmtime.Run the simulator directly on your host machine using the native Go runtime:
go run ./cmd/go-bash-wasm/
To develop the frontend locally:
GOOS=js GOARCH=wasm go build -o ui/static/main.wasm ./cmd/go-bash-wasm/
cp $(go env GOROOT)/lib/wasm/wasm_exec.js ui/static/
cd ui
npm install
npm run dev
Access at http://localhost:5173.Built for the web, including WASM optimizations via binaryen.
# Build and run (mapped to port 8080)
docker build -t go-bash-ui -f ui.Dockerfile .
docker run -it --rm -p 8080:80 go-bash-ui
Supports OPTIMIZE=fast (default) or OPTIMIZE=small build args.
Runs the shell in a secure wasip1 container.
docker build -t go-bash-cli -f Dockerfile .
docker run -it --rm go-bash-cli
We ensure 100% behavioral parity through rigorous testing in both backend and frontend.
Runs all unit tests for the shell and coreutils implementations:
go test -v ./...
Runs Svelte component and logic tests:
cd ui
npm run test
You can run a full build/test cycle inside Docker to verify environment parity:
# This triggers both go tests and npm tests as part of the build
docker build -f ui.Dockerfile .
Developed by the go-bash-wasm team. Aiming for 100% functional parity with GNU tools.