Linux shell playground
A real Linux booted in the page (a small kernel and BusyBox in the v86 x86 emulator) with a terminal, sample logs, CSVs and a config tree in your home directory, and 26 exercises — text pipelines, find and xargs, redirection, permissions, processes and signals, environment variables, loops — that check your answer.
Added
Works with
- Shell command explainer Linux and macOScopies a command and opens this shell to try it
How to use it
This is a real Linux kernel and a real shell, not an imitation. The page boots a small Linux (kernel 6.6 with BusyBox 1.36, built for this tool) inside v86, an x86 PC emulator compiled to WebAssembly, and connects its serial console to a terminal. Commands behave exactly as they do on a Linux box, error messages included, because they are the same programs. Nothing is installed and nothing you type leaves the browser.
Your home directory starts with things worth poking at: a web server access log and an application
log, sales and user CSVs, a small configuration tree with backups and TODOs, two projects with
build leftovers, a couple of scripts, and a second user (learner) for trying permissions.
How to use it
Press Boot Linux. The page downloads about 4.4 MB (see below); booting then takes
a few seconds and the kernel’s messages scroll past in the terminal. When the prompt
root@linux:~# appears, type away: Tab completion, ↑ for history, Ctrl+C, Ctrl+Z and vi work.
Exercises. Pick one on the right. Each states a goal, explains the commands involved, and has a Hint and a model answer (which can type itself into the terminal). Press Check when you think you have it:
-
For exercises about output (the top five IP addresses, the total per region), Check works out the expected output inside the guest and compares it with what your last command printed. Spacing differences do not matter; order does, unless the question is a set of file names.
-
For the others, Check looks at the result: the file you wrote, a file’s mode, whether a process is still running, whether
learnercan now write to a directory.
The groups:
-
Text —
grep -c,cut | sort | uniq -c | sort -rn | head,awkfields and sums,sed -i,wc. -
Finding files —
find -name / -size,grep -rl, and deleting withfind -print0 | xargs -0(one of the files has a space in its name, which is the point). -
Redirection and pipes —
>,>>,2>,tee. -
Permissions — making a script executable, mode 600, a shared directory with the sticky bit. The permissions calculator converts between octal and
rwxforms. -
Processes — background jobs, finding and killing a process, and one that ignores
SIGTERM(selecting those exercises starts the misbehaving program for you). -
Environment variables —
export, per-command variables, andPATH. -
Shell scripting —
forloops, a script with a loop,while IFS=, read.
Ticks for finished exercises are kept in this browser. Reset files puts the sample files back;
Reboot starts over completely. Save transcript downloads everything the console printed. The
Files tab lists the sample files, and can put a file of yours into /mnt in the guest or download
one you copied there. The share link opens the tool at the current exercise.
What is going on
-
The emulator is v86 0.5.472, loaded from jsDelivr (
libv86.jsandv86.wasm, about 2.3 MB), with the SeaBIOS and VGA BIOS images from the v86 repository (pinned to a commit, also via jsDelivr). It runs on the page’s main thread in short slices, so the page stays responsive, and it needs no special headers (no SharedArrayBuffer). -
The Linux image (2.0 MB) is served by this site: an i686 Linux 6.6 kernel, configured small, with Alpine Linux’s static BusyBox built in as its root file system. The page checks its SHA-256 before booting it. How it is built, and where every source comes from, is in SOURCE.md, with the build script and configuration beside it.
-
The terminal is xterm.js. It is connected to the PC’s first serial port.
-
The checker is a few lines of shell on the second serial port, started at boot: the page sends it check scripts through
/mnt(a 9p file system shared with the page) and reads the replies. It shows up inpsassh /mnt/.pg-agent.sh; if you kill it, the page starts it again. -
The guest has 64 MB of memory and no network. Everything lives in memory and is gone when you close the page.
For one-shot runs of other languages and SQL see the code sandbox; for regular expressions on their own, the regex tester; for learning git, the git trainer.
Privacy
When you press Boot, the page downloads the emulator, the BIOS files and the xterm.js terminal from cdn.jsdelivr.net (which sees an ordinary download request) and the Linux image from this site. Everything you type and every file runs and stays in the emulator in your browser; nothing is sent anywhere.
Licences
v86 is BSD-2-Clause, SeaBIOS and the VGA BIOS are LGPL-3.0, and xterm.js is MIT; all three are loaded from the CDN. The Linux kernel and BusyBox in the image are GPL-2.0: the image is built from unmodified upstream sources, and SOURCE.md lists them, with the build files, so the corresponding source is complete.
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser — network requests go only to the services named on this page.