pwd
NavigationPrint working directory
Shows the absolute path of the directory you are currently in.
$ pwd
A quick reference for every command the in-browser sandbox supports. Search by command name, concept, or task — works offline and on GitHub Pages. Press / anywhere to focus search.
Print working directory
Shows the absolute path of the directory you are currently in.
$ pwdChange directory
Moves you into a different directory. Use `cd ..` to go up one level, `cd ~` to jump home, or `cd -` to flip back to the previous directory.
$ cd projects$ cd ..$ cd ~$ cd /tmpList directory contents
Lists files and folders. `-l` shows a long listing with permissions, owner and size. `-a` includes hidden files (those starting with a dot).
$ ls$ ls -l$ ls -la$ ls /etcDirectory stack (cd, but remembers where you came from)
In real shells, `pushd dir` jumps to a new directory and pushes the current one onto a stack, `popd` pops back, and `dirs` prints the stack. The Learninx shell has no real stack, so these are documented for reference — use `cd -` to flip back to the previous directory.
$ pushd projects$ popd$ dirsMake a directory
Creates a new directory. `-p` (parents) creates any missing intermediate directories and silently succeeds if the target already exists.
$ mkdir lab$ mkdir -p a/b/cCreate an empty file (or update its timestamp)
Creates an empty file if it does not exist, otherwise updates the modified time of the existing file.
$ touch notes.txtCopy files and directories
Copies a file to a new location. `-r` is required to copy a directory recursively.
$ cp notes.txt copy.txt$ cp -r src backupMove or rename files and directories
Renames a file or moves it to a new location. Works for both files and directories — there is no separate `rename` command.
$ mv notes.txt renamed.txt$ mv report.txt archive/Remove files or directories
Deletes a file. `-r` deletes a directory and everything inside it. `-f` skips the confirmation prompt. Be careful: there is no recycle bin.
$ rm notes.txt$ rm -r lab$ rm -rf buildRemove empty directories
Like `rm -r`, but refuses to delete a directory that still contains files. Safer for scripts.
$ rmdir old-logs$ rmdir -p a/b/cCopy a file into place (and create dirs with -D)
Copies a source file to a destination, optionally creating any missing intermediate directories (`-D`). The in-browser sandbox runs it as a safety-first copy.
$ install -D src/header.h /usr/include/header.hCreate a temporary file in /tmp
Makes a fresh empty file in `/tmp` whose name ends with a random suffix, and prints the path. Great for shell scripts that need scratch space.
$ mktemp$ mktemp tmp.XXXXXXXXShrink or extend a file to a given size (-s N)
Sets a file to exactly N bytes. If the file was longer it is cut; if shorter, the new bytes are null-padded. Useful for log rotation in scripts.
$ truncate -s 0 app.log$ truncate -s 1M image.binPrint the value of a symbolic link
In the in-browser sandbox there are no real symlinks, so this prints the path you pass. Provided for script compatibility.
$ readlink /usr/bin/pythonEstimate file / directory space usage
Walks a path and prints the total bytes it uses. `-h` switches to human units (K, M, G), `-s` prints only the summary line.
$ du -sh projects$ du -h --max-depth=1Show a compact summary of a file
Prints size, line count, word count and the (sandbox) last-modified time. The in-browser equivalent of `stat` for a quick glance.
$ fileinfo notes.txtCreate a link between files (simulated)
Simulated. In a real Linux system `ln -s` makes a symbolic link, `ln` (no flag) makes a hard link. The sandbox just acknowledges the request.
$ ln -s config.txt config.linkFast incremental file transfer / sync
Syncs files between two paths, copying only what changed. Flags to remember: `-a` (archive, preserves perms/times), `-v` (verbose), `--dry-run` (preview), `--delete` (mirror deletions). Not implemented in the sandbox — shown for cheatsheet completeness.
$ rsync -av src/ backup/$ rsync -av --delete src/ dest/Bulk-rename files with a Perl regex
Debian/Ubuntu `rename` (`prename`) takes a Perl substitution and applies it to every filename you pass. Powerful but easy to misuse — always run without the `-f` flag first to preview.
$ rename "s/.txt/.md/" *.txt$ rename "y/a-z/A-Z/" *.txtDisplay a directory tree
Renders a pretty ASCII tree of the directory starting at the given path. Pure visualisation — no flags supported in the sandbox.
$ tree$ tree projectsDisplay file status
Prints size, permissions, inode (simulated) and modification time. Verbose alternative to `ls -l`.
$ stat notes.txt$ stat /etc/passwdDetermine file type
Sniffs the contents and prints what kind of file it is: ASCII text, empty, directory, or which interpreter a `#!/...` shebang points to.
$ file notes.txt$ file /usr/bin/lsStrip the directory part of a path
Prints only the final filename component. Useful in shell loops over `find` results.
$ basename /etc/nginx/nginx.confStrip the last component of a path
Prints everything except the final filename component — the directory portion of the path.
$ dirname /etc/nginx/nginx.confPrint the resolved absolute path
Resolves any `.`, `..`, or relative segments and prints a clean absolute path.
$ realpath ../notes.txt$ realpath ~/projectsCompare two files line by line
Walks both files and prints lines that differ, prefixed with `<` (first file) or `>` (second file). When files match, prints `(files are identical)`.
$ diff old.txt new.txtShow the last lines of a file
By default prints the last 10 lines. Pass `-n N` to change the count. Combine with `-f` (simulated) to follow a growing log file.
$ tail notes.txt$ tail -n 5 /var/log/syslogPrint MD5-style digests of files
Hashes each file and prints a 32-hex digest followed by the filename. Use it to spot-check that a file has not changed. (Sandbox: non-cryptographic.)
$ md5sum *.isoPrint SHA-256-style digests of files
Hashes each file and prints a 64-hex digest followed by the filename. Stronger than MD5 for tamper detection. (Sandbox: non-cryptographic.)
$ sha256sum backup.tarPrint printable strings (≥4 chars) from a file
Pulls out runs of printable ASCII at least 4 characters long. Classic tool for inspecting binary blobs.
$ strings app.bin | lessDump file in octal / hex / chars
Prints a numbered byte dump of the file. `-x` shows hex, `-c` shows printable characters (escapes for control bytes), default is octal.
$ od -c notes.txt$ od -x notes.txtHex dump of a file
Prints a hex+ASCII view of the file, 16 bytes per line. Useful for inspecting binary data and reverse engineering.
$ xxd app.bin | headPrint the contents of a file
Writes the file to standard output. Great for short files. For longer files prefer `less` or `head` / `tail`.
$ cat notes.txt$ cat /etc/hostnameShow the first lines of a file
By default prints the first 10 lines. Pass `-n` to change the count.
$ head notes.txt$ head -n 5 /etc/passwdCount lines, words and bytes
By default prints three numbers: lines, words, bytes. Common flags: `-l` (lines only), `-w` (words only), `-c` (bytes only).
$ wc notes.txt$ wc -l notes.txtUse stat -c to format specific fields
Beyond just printing everything, `stat -c "%a %n"` prints the octal mode then the name — useful in scripts. The Learninx `stat` command accepts `-c` and a small set of format tokens.
$ stat -c "%a %n" notes.txt$ stat -c "%s" image.pngPage through a file one screen at a time
Sandbox stub — prints a TUI-style view of the file (just like `nano`). In a real terminal, `less file` lets you scroll with arrows, search with `/`, and quit with `q`.
$ less notes.txt$ more /etc/servicesFormat and print data
Like `echo` but with C-style format specifiers. `%s` inserts the next argument as a string, `%d` parses the next argument as an integer. Useful in scripts where you need exact control.
$ printf "hello %s\n" world$ printf "%d + %d = %d\n" 1 2 3Print a string repeatedly
Echoes its argument (or `y`) on repeat, forever in a real shell. The sandbox prints five lines and a `... (truncated)` marker so it does not flood the terminal.
$ yes$ yes "I agree" | head -n 3Print text to the screen
Writes its arguments to standard output. Combine with `>` to write to a file or `>>` to append.
$ echo hello$ echo hello > notes.txt$ echo more >> notes.txtBeginner-friendly text editor
In the sandbox, `nano file` prints a TUI-style view of the file and tells you which commands to use for real edits. Use `echo > file` to overwrite or `>>` to append.
$ nano notes.txtModal text editor
In the sandbox this prints a TUI view and lists the editing commands. In a real terminal: press `i` to enter insert mode, `Esc` to leave, `:wq` to save and quit.
$ vi notes.txt$ vim notes.txtRead a line from stdin into a variable
Built-in. `read -p "name? " name` prompts and stores. `-s` silent (for passwords), `-r` raw (no backslash escapes), `-t N` timeout after N seconds.
$ read -p "Name? " name$ read -s -p "Password: " pwEvaluate a condition (used in if / while)
Returns success or failure based on a test. Common operators: `-f file` (is a file), `-d dir` (is a dir), `-z "$s"` (empty string), `n1 -eq n2`. `[` and `test` are the same program.
$ [ -f notes.txt ] && echo yes$ [ "$x" = "y" ]$ [ -d /tmp ]Replace the current shell with a command
`exec vim` replaces the current shell — no return, no subshell. `exec > log.txt` redirects all subsequent stdout to a file without forking.
$ exec vim notes.txt$ exec > log.txt 2>&1Sort lines of text (supports -r -n -u)
Orders lines alphabetically by default. `-n` sorts numerically, `-r` reverses, `-u` keeps only unique lines.
$ sort names.txt$ sort -nr scores.txt$ sort -u tags.txtRemove adjacent duplicate lines (supports -c -i)
Collapses runs of identical adjacent lines into one. For a global unique pass, pipe through `sort` first: `sort file | uniq`. `-c` prefixes each line with a count.
$ uniq -c access.log$ sort tags.txt | uniqCut fields or characters from input
Splits each line by a delimiter (`-d`, default Tab) and prints the chosen fields (`-f`) or character positions (`-c`). Lists like `1,3-5` are supported.
$ cut -d: -f1 /etc/passwd$ cut -c1-10 file.txtTranslate or delete characters
Maps characters in SET1 to characters in SET2 (one-to-one, by position). `-d` deletes the listed characters instead. Reads from a file argument or piped stdin.
$ tr a-z A-Z < file.txt$ tr -d "\r" < dos.txtPrint lines in reverse order
Reads a file and prints its lines from bottom to top. `cat` reversed, character-by-character.
$ tac notes.txtReverse each line of input
Reads input and prints each line with its characters in reverse order. Lines themselves stay in order.
$ rev names.txtNumber lines of input
Prefixes each non-empty line with its 1-based line number, right-aligned in 6 columns. Pair with `cat` to get a numbered listing.
$ nl notes.txt$ cat notes.txt | nlMerge lines of files side by side (-d delim)
Reads two or more files in parallel and joins their lines column-by-column with a delimiter (default Tab).
$ paste names.txt phones.txt$ paste -d, a.csv b.csvJoin two files on a common field
Merges two files by matching the first whitespace-separated field of each line. Both files must be sorted on that field.
$ join users.txt groups.txtStream editor — supports s/find/replace/[g]
Applies a substitution expression to one or more files. The sandbox only supports the `s/find/replace/g` form (no addresses, no other commands). Add `g` to replace every match on a line.
$ sed "s/old/new/g" notes.txt$ sed 's/foo/bar/' file.txtSimple awk — `awk "{print $N}"` prints field N
The sandbox accepts the most common form: `awk "{print $N}" file` prints whitespace-separated field N of every line. `$0` prints the whole line.
$ awk "{print $1}" access.log$ awk "{print $0}" notes.txtbase64 encode or decode
Reads a file and either base64-encodes it (default) or decodes it (`-d`). Handy for embedding binary in JSON or copying certs as text.
$ base64 photo.png$ base64 -d ciphertext.txtRead stdin, write to file and stdout (-a appends)
Splits a pipeline: the data flows through to stdout and is also written to one or more files. `-a` appends instead of overwriting.
$ echo hello | tee out.txt$ cat log | tee -a all.log | grep ERRORBuild and execute command lines (simulated)
Takes whitespace-separated tokens from stdin and runs the given command once per token, appending the token as the last argument. Lets you turn `find` output into a batch job.
$ find . -name "*.log" | xargs rm$ echo "a b c" | xargs echo item:Format input as aligned columns (-t table)
Reads whitespace- or delimiter-separated input and re-emits it in neat aligned columns. `-t` auto-detects column widths; `-s` changes the delimiter; `-o` sets a separator for the output.
$ cat data.txt | column -t$ cut -d: -f1,6 /etc/passwd | column -t -s:Convert tabs to spaces (or back)
`expand` replaces TAB characters with spaces (default 8). `unexpand` does the reverse — useful when pasting into code that disallows tabs.
$ expand notes.txt$ unexpand -t 4 notes.txtReformat text to fit a width
Reflows long lines so they fit within a maximum width (default 75). Keeps paragraph breaks intact. Pair with `pr` for printable output.
$ fmt notes.txt$ fmt -w 80 essay.mdWrap each line at a width (no word awareness)
Like `fmt` but dumber: it wraps at an exact column, breaking words in half if needed. Use `-s` to break only on spaces.
$ fold -w 40 notes.txt$ fold -w 80 -s long.txtPaginate text for printing
Adds headers, footers and page breaks to a text file so it can be printed or archived cleanly. `-l N` changes page length, `-w N` the width.
$ pr notes.txt$ pr -l 20 -w 60 essay.mdShuffle lines randomly
Writes a random permutation of input lines. `-n N` prints only N of them. Great for picking a random sample or choosing a winner.
$ shuf names.txt$ shuf -n 1 names.txt$ shuf -i 1-100 -n 5Print a numeric sequence (start [step] end)
Writes one number per line, from `start` (default 1) to `end`, optionally stepping by `step`. `-w` equalises widths with leading zeros.
$ seq 5$ seq 1 2 10$ seq -w 1 10Prime-factor decomposition of an integer
For each input integer, prints the prime factors. `factor 60` → `60: 2 2 3 5`. Pure command-line arithmetic fun.
$ factor 60$ factor 17$ echo 1024 | factorCompare two sorted files line by line (3 columns)
Outputs three columns: lines only in the first file, lines only in the second, and lines in both. `-i` is a typo; use `-12` to suppress columns 1 and 2 and show only common lines.
$ comm a.txt b.txt$ comm -12 a.txt b.txtTopological sort of a partial order
Reads pairs `A B` meaning `A must come before B` and prints a valid total order. Useful in build systems for figuring out which targets depend on which.
$ tsort deps.txt$ echo -e "b a\nc b" | tsortConvert text between character encodings
Re-encodes text from one charset to another (e.g. UTF-8 ↔ Latin-1). `-l` lists all known encodings. Sandbox is informational.
$ iconv -f UTF-8 -t ISO-8859-1 notes.txt$ iconv -lUse -n, -I{}, -0 for safer batched commands
Advanced flags: `-n 2` runs the command two args at a time; `-I{}` replaces `{}` with the input (lets the placeholder sit anywhere); `-0` splits on NUL bytes (safe for filenames with spaces — pair with `find -print0`).
$ find . -name "*.log" -print0 | xargs -0 rm$ echo a b c | xargs -n1 echo got:Find files by name (supports -name <glob>)
Walks a directory tree and prints the paths that match. `-name "*.log"` is the most common use; supports `*` and `?` wildcards.
$ find .$ find /etc -name "*.conf"Search text for a pattern (supports -i -v -n)
Prints lines that match a pattern. `-i` ignores case, `-v` inverts the match, `-n` prefixes each hit with its line number. Combine with `|` to filter any command’s output.
$ grep error app.log$ grep -in "TODO" notes.txt$ cat app.log | grep 500Find files by name using a prebuilt index
Real `locate` queries a database (usually updated nightly by `updatedb`) so it is far faster than `find`. The sandbox does not run it — use `find <path> -name "<glob>"` here.
$ locate nginx.conf$ locate -i readme.mdLocate the binary, source and man page for a command
Returns the absolute paths of the executable, its source file (if any) and its man page. The sandbox only simulates the binary path.
$ whereis ls$ whereis grepFast recursive grep (typically faster than grep -r)
Default on many modern systems. Recursively greps a directory, respects `.gitignore`, and skips binary files automatically. Not in the sandbox; shown for cheatsheet completeness.
$ rg TODO src/$ rg -i error logs/$ rg -n "fn main" .Recursive grep, ignores .gitignore, very fast
A predecessor to `rg`. Same idea — recursive grep that skips ignored files. Not in the sandbox; included for reference.
$ ag TODO src/$ ag -i error logs/grep replacement aimed at source code
Defaults to recursive search and skips VCS metadata dirs. Less popular than `ag` / `rg` now, but still in many tutorials.
$ ack TODO src/$ ack --perl "\bTODO\b"grep with fixed strings (no regex)
`grep -F` shortcut. Treats the pattern as a literal string, so no escaping needed for `.`, `*`, `(`, etc. Faster on huge inputs.
$ grep -F "error: file not found" logs.txt$ fgrep "[INFO]" app.loggrep with extended regex (same as grep -E)
Treats the pattern as an ERE — so `+`, `?`, `()`, `|` are metacharacters without a backslash. Modern usage is just `grep -E`.
$ grep -E "err|warn" app.log$ egrep "^[A-Z]+$" tokens.txtPrint group memberships for a user
With no argument, lists the groups of the current user. With a username, lists that user’s groups.
$ groups$ groups rootPrint user identity
Prints the numeric UID, primary GID and the full list of group memberships for the current user.
$ id$ id rootRun a command as another user (simulated)
Pretends to elevate privileges and runs the command. The sandbox cannot really escalate, but the call is accepted so scripts keep working.
$ sudo apt update$ sudo systemctl restart nginxChange file permissions
Updates the read / write / execute bits. The octal form is easiest: 7 = rwx, 6 = rw-, 5 = r-x, 4 = r--, 0 = ---.
$ chmod +x script.sh$ chmod 755 script.sh$ chmod 600 secret.txtList running processes
Shows the processes started in the current sandbox shell. Informational only — you cannot kill other sessions.
$ psChange file owner and group
Sets the user and (optionally) the group of a file. `chown user:group file` sets both at once. Requires root in a real shell — sandbox is informational.
$ chown learner notes.txt$ chown learner:staff notes.txt$ chown -R root /etc/appChange the group ownership of a file
Like `chown :group file` but only changes the group. Useful when you want to share a file with a project team without touching the owner.
$ chgrp staff notes.txt$ chgrp -R devs project/Default permission mask for new files
Returns the mask subtracted from 0666 (files) and 0777 (dirs) when new files are created. Default 022 means new files come out as 0644. Set it per-session: `umask 077` for private files.
$ umask$ umask 077Change / list file attributes (ext2/3/4)
Lower-level than `chmod`. Lets you mark files immutable (`+i`), append-only (`+a`), or compress (`+c`). Requires root. Sandbox is informational.
$ chattr +i /etc/passwd$ lsattr notes.txtSwitch user (default root)
With no argument, `su` opens a root shell. `su learner` switches to another user. The `-` flag also loads that user’s environment. Sandbox informational.
$ su$ su - learner$ su -c "apt update" rootChange a user password
With no argument, changes the current user’s password. As root, `passwd learner` resets another user’s. Sandbox informational.
$ passwd$ passwd learnerManage user accounts
`useradd name` creates a user, `userdel -r name` removes one (and their home), `usermod -aG group user` adds them to a group. All require root.
$ useradd -m alice$ usermod -aG sudo alice$ userdel -r aliceAdd or remove groups
`groupadd devs` creates a group, `groupdel devs` removes one. Pair with `usermod -aG` to add users to it.
$ groupadd devs$ groupdel devsSafely edit the sudoers file
Opens `/etc/sudoers` in the system editor with a syntax check before saving — never edit that file with a regular editor. Sandbox informational.
$ visudo$ visudo -f /etc/sudoers.d/devsShow network interfaces
Older but still-common tool for inspecting IP addresses, MAC addresses and packet counts per interface. (`ip addr` is the modern equivalent.)
$ ifconfig$ ifconfig eth0Show / manipulate routing (simulated, `ip addr`)
Modern replacement for `ifconfig`. The sandbox only supports `ip addr`, which prints the active IPv4 and IPv6 addresses per interface.
$ ip addr$ ip aPing a host (simulated)
Sends ICMP echo requests to a host and reports round-trip times. The sandbox simulates a successful three-packet exchange.
$ ping learninx.dev$ ping -c 3 1.1.1.1Fetch a URL (simulated)
Pretends to make an HTTP request. `-I` / `--head` returns just the response headers; without it, returns a small HTML stub.
$ curl https://learninx.dev$ curl -I https://learninx.devDownload a URL to disk (simulated)
Like `curl`, but writes the response to a file by default. Sandbox reports a successful download with byte count.
$ wget https://learninx.dev/index.htmlOpen a remote shell (simulated)
Pretends to log into the given host (format `user@host`) and prints a sample welcome banner.
$ ssh learner@learninx.dev$ ssh root@server.localDNS lookups (query name servers)
Both query DNS to resolve a hostname to an IP. `dig` is more verbose and scriptable; `nslookup` is shorter and more interactive-friendly. Sandbox informational.
$ dig learninx.dev$ nslookup learninx.dev$ dig +short MX gmail.comShow the path packets take to a host
Sends packets with increasing TTLs and lists each router that responds, showing where the route slows or fails. Sandbox informational.
$ traceroute learninx.dev$ traceroute -n 1.1.1.1Show open ports and active connections
`ss` is the modern replacement for `netstat`. Common flags: `-tuln` (listening TCP/UDP, numeric), `-p` (show process), `-s` (summary stats).
$ ss -tuln$ netstat -tulnp$ ss -sSecure copy (over SSH)
Copies files between hosts using SSH for transport. Format: `scp source user@host:dest` or the reverse. `-r` recurses, `-P` sets a non-default port.
$ scp notes.txt learner@server:~/notes.txt$ scp -r ./project learner@server:~/Interactive FTP over SSH
Starts an interactive session for browsing and transferring files on a remote host. Commands: `get`, `put`, `ls`, `cd`, `bye`.
$ sftp learner@server$ sftp -P 2222 learner@serverTalk to a TCP port in plaintext
Old but still handy: `telnet host port` opens a raw TCP connection. Useful for hand-testing protocols like SMTP, HTTP, or Redis. Plaintext — do not use for anything sensitive.
$ telnet learninx.dev 80$ telnet mail.example.com 25Swiss-army knife for TCP and UDP
Read or write to any TCP/UDP port from the shell. `-l` listens, `-z` does a port scan, `-v` is verbose. Combine with `mkfifo` for quick file transfer.
$ nc -lv 8080$ nc -zv learninx.dev 443$ echo hello | nc learninx.dev 80Routes, links and neighbour tables
Beyond `ip addr`, real Linux supports `ip route`, `ip link`, `ip neigh` and more. The Learninx sandbox only handles `ip addr` — other forms print `not implemented in sandbox`.
$ ip route$ ip link$ ip neighList all sockets with owning processes
Power-user shortcut. `t` TCP, `u` UDP, `n` numeric, `a` all, `p` process — shows you what is listening and which PID owns it. Requires root for the `p` column.
$ ss -tunap$ ss -tunap Tape archive — pack/unpack files (-c -x -t -z -j -J)
The classic archive tool. Common flag combinations: `-czf out.tgz files` (gzip-compressed create), `-xzf in.tgz` (extract), `-tzf in.tgz` (list contents). `-C` changes directory for the operation.
$ tar -czf backup.tgz project/$ tar -xzf backup.tgz$ tar -tzf backup.tgz$ tar -cjf backup.tar.bz2 project/Compress / decompress a single file (.gz)
`gzip file` replaces `file` with `file.gz`. `gunzip file.gz` does the reverse. Pair with `tar -czf` to get `.tar.gz` archives. `-k` keeps the original.
$ gzip notes.txt$ gunzip notes.txt.gz$ gzip -k big.logHigher-ratio compression than gzip (.bz2)
Slower but compresses better than `gzip`. Same interface: `bzip2 file`, `bunzip2 file.bz2`. Often seen as `.tar.bz2` or `.tbz2`.
$ bzip2 big.log$ bunzip2 big.log.bz2LZMA compression — often the smallest (.xz)
Modern, high-ratio compressor. Common extension `.tar.xz` (used by many Linux kernel releases). Slower than gzip.
$ xz image.iso$ unxz image.iso.xzCross-platform archive format (.zip)
`zip out.zip file` adds `file` to a new zip. `unzip in.zip` extracts. `-r` recurses, `-e` encrypts, `-l` lists. Common for sharing files with Windows users.
$ zip -r project.zip project/$ unzip project.zip -d ./out$ unzip -l project.zip7-Zip — supports many formats, high compression
`p7zip` provides `7z` on Linux. Compresses to `.7z` (often smallest) and can read `.zip`, `.tar.gz`, `.rar` and more. `a` adds, `x` extracts, `l` lists.
$ 7z a backup.7z project/$ 7z x backup.7z$ 7z l backup.7zSelective extraction and listing
Common flags: `-l` list, `-d DIR` extract into DIR, `-o` overwrite without prompt, `-n` never overwrite, `-p` print to stdout, `-q` quiet.
$ unzip -l archive.zip$ unzip -d ./out archive.zip$ unzip -p archive.zip readme.txtExclude files, append, stream through a pipe
Useful extras: `--exclude="*.log"` skips matches; `-rf archive.tar newfile` appends to an existing archive; `--strip-components=N` strips N leading path components on extract; pipe to compress on the fly.
$ tar -czf out.tgz --exclude="*.log" project/$ tar -xzf in.tgz --strip-components=1$ tar -cf - src/ | ssh user@host "tar -xf - -C /dest"Copy files in / out of an archive (low-level)
Predecessor to `tar`; still used inside `initramfs` images. `find . | cpio -o > archive.cpio` creates one, `cpio -i < archive.cpio` extracts.
$ find . | cpio -o > archive.cpio$ cpio -id < archive.cpioOperate directly on gzip-compressed files
Family of helpers: `zcat file.gz` is `cat` for gzip; `zless file.gz` is `less`; `zgrep PATTERN file.gz` is `grep` — no manual decompression step needed.
$ zcat app.log.gz$ zless app.log.gz$ zgrep ERROR app.log.gzPrint environment variables
Lists all variables currently set in the shell’s environment, one per line as `NAME=value`. Use `export NAME=value` to set one.
$ env$ env | grep PATHSet an environment variable
Adds (or updates) a variable in the shell’s environment. Format is `export NAME=value`. Variables set this way are visible to subsequent commands in the same session.
$ export EDITOR=vim$ export PATH="$HOME/bin:$PATH"Exit the shell (simulated)
Acknowledges the request and prints `logout`. The in-browser shell cannot really be closed — refresh the page to start a new session.
$ exitPause for N seconds (simulated)
Real `sleep` waits in real time. The sandbox returns immediately so your lesson does not stall.
$ sleep 1$ sleep 0.5 && echo doneDo nothing, successfully
Exits with status 0 and produces no output. Mostly useful in shell scripts: `while true; do ...; done`.
$ trueDo nothing, unsuccessfully
Exits with a non-zero status and produces no output. Useful for testing `&&` / `||` chains.
$ false || echo "fell through"Print machine architecture
Always reports `x86_64` in the sandbox. In real Linux it returns the CPU architecture of the host.
$ archPrint the number of processing units available
Returns the number of logical CPU cores. The sandbox reports 4. Used in build scripts to parallelise jobs.
$ nproc$ make -j$(nproc)List block devices
Prints a tree of disks and partitions: names, sizes, mountpoints. Sandbox returns a small fixed example so you can recognise the columns.
$ lsblk$ lsblk -fDisplay CPU architecture information
Detailed dump of CPU model, cores, threads, cache sizes and feature flags. Sandbox returns a representative sample.
$ lscpuList the ranges of available memory
Summarises the physical memory ranges the kernel can see, with size and online/offline state. Sandbox returns a small sample.
$ lsmemList open files (simulated)
Classic sysadmin tool. In a real shell it lists every open file descriptor. The sandbox returns a few example entries so the columns make sense.
$ lsof$ lsof /etc/passwdPrint the kernel ring buffer (simulated)
Shows the kernel’s recent log messages — useful for spotting hardware or driver problems at boot. Sandbox returns a representative slice.
$ dmesg$ dmesg | grep -i usbShow last logged-in users (simulated)
Reads `/var/log/wtmp` (sandbox: a small static sample) and prints the recent login history, with session durations.
$ last$ last learnerShow who is logged on
Prints one line per currently logged-in user: username, terminal, login time, and remote host (in parentheses).
$ who$ who -bReturn the user's login name
Prints the account name that was used to log into the current session, even after a `su` switch.
$ lognameReport virtual memory statistics
A one-line snapshot of process, memory, swap, I/O and CPU activity. Sandbox returns a representative line.
$ vmstat$ vmstat 2Report CPU and I/O statistics
Per-device and CPU utilisation numbers — useful for spotting I/O bottlenecks. Sandbox returns a representative table.
$ iostat$ iostat -xz 2Send a signal to a process (simulated)
Takes a process ID and (in real shells) sends a signal — default `TERM`. Sandbox acknowledges the request and refuses non-numeric PIDs.
$ kill 1234$ kill -9 1234Locate a command
Prints the absolute path of the executable that would run if you typed the command. In the sandbox it returns `/usr/bin/<cmd>` for known commands.
$ which ls$ which pythonRun a command immune to hangups (simulated)
In real Linux, `nohup` lets a command keep running after you log out. The sandbox acknowledges the request but does not background processes.
$ nohup ./long-job.sh &Print system information
Prints the kernel name. `-a` includes the version, architecture and hostname.
$ uname$ uname -aShow how long the system has been up
Prints a short uptime line. In the sandbox this is a simulated value.
$ uptimeShow memory usage
Prints total, used and free memory. `-h` switches to human-readable units (K, M, G).
$ free$ free -hShow disk space usage
Reports the filesystem disk space usage. `-h` switches to human-readable units.
$ df$ df -hPrint the current user
Writes your current username. In the sandbox you are always `learner`.
$ whoamiPrint the system hostname
Writes the name of the current machine.
$ hostnameShow the current date and time
Prints the current local date and time.
$ dateClear the terminal
Scrolls the terminal so the prompt sits at the top of the visible area. Shortcut: Ctrl+L.
$ clearFlush filesystem buffers to disk
Forces all pending writes in memory to be written to the disk(s). Run before risky operations or as a final step in shutdown scripts. Sandbox no-op.
$ syncControl systemd services (start/stop/enable/status)
Modern way to manage services. `systemctl status nginx` shows logs and state, `systemctl enable --now nginx` starts it and turns it on at boot. Not available in the sandbox.
$ systemctl status nginx$ sudo systemctl restart sshd$ systemctl enable --now cronSysV-style service control
Older interface (`service nginx restart`) still works on most distros thanks to systemd compatibility shims. Prefer `systemctl` on new systems.
$ service nginx status$ sudo service ssh restartRead the systemd journal (logs)
`journalctl -u nginx` shows logs for one unit; `-f` follows; `--since "1 hour ago"` filters by time; `-p err` filters by priority.
$ journalctl -u nginx -f$ journalctl -p err --since today$ journalctl --list-bootsSchedule recurring jobs
Edit with `crontab -e`, list with `crontab -l`. A line is `m h dom mon dow command`. `@reboot`, `@daily` etc. are shortcuts.
$ crontab -l$ crontab -e$ */5 * * * * /opt/job.shSchedule a one-shot job at a specific time
`at 14:00` then type commands, Ctrl+D to finish. Unlike `cron`, jobs run once and disappear. `atq` lists pending, `atrm N` removes.
$ at 14:00$ atq$ atrm 3Stop, restart, or power off the machine
`shutdown -h now` halts immediately; `shutdown -r +5` reboots in 5 minutes; `reboot` and `poweroff` are short aliases. All require root in a real shell.
$ sudo shutdown -h now$ sudo reboot$ sudo shutdown -r +5 "kernel update"Legacy init control (SysV)
`init 0` halts, `init 6` reboots, `runlevel` prints the current and previous level. Largely replaced by `systemctl`. Sandbox informational.
$ runlevel$ sudo init 6Job control: move processes between background and foreground
Append `&` to start in background, `jobs` lists them, `fg %1` brings #1 to the front, `Ctrl+Z` suspends, `bg %1` resumes in background, `disown %1` detaches.
$ sleep 60 &$ jobs$ fg %1$ Ctrl+Z then bg %1Run with adjusted scheduling priority (-20 highest, 19 lowest)
Default nice value is 0. `nice -n 10 make` runs `make` at lower priority so it does not starve interactive jobs. `renice` changes an existing process.
$ nice -n 10 make$ sudo renice -n -5 -p 1234Measure how long a command takes
`time command` reports wall time, user CPU time and system CPU time. The Learninx shell exposes a builtin `time`; the binary `/usr/bin/time -v` gives even more detail in real shells.
$ time find / -name "*.log"$ /usr/bin/time -v makeRun a command with a hard time limit
`timeout 5s long-cmd` kills the command after 5 seconds. Sends `TERM` by default; `--signal=KILL` for a more aggressive end. Sandbox no-op.
$ timeout 5s ping 8.8.8.8$ timeout --signal=KILL 30s ./build.shRe-run a command every N seconds
`watch -n 2 "df -h"` re-runs `df -h` every 2 seconds, highlighting changes. `-d` highlights differences between runs. Sandbox informational.
$ watch -n 2 "df -h"$ watch -d ls /tmpList PCI / USB devices and loaded kernel modules
`lspci` enumerates PCI/PCIe hardware, `lsusb` does USB, `lsmod` shows currently loaded kernel modules. All require a real kernel — sandbox prints a representative sample.
$ lspci$ lsusb$ lsmodLoad / unload kernel modules
`modprobe name` loads a module and its dependencies. `rmmod name` removes it. `insmod path.ko` loads by file path, no dependency resolution. All require root.
$ sudo modprobe br_netfilter$ sudo rmmod br_netfilter$ sudo insmod /lib/modules/.../mymod.koTrace syscalls / library calls of a process
`strace -e openat cmd` shows which files a command opens. `ltrace` does the same for library calls. Powerful debugging tools — slow the target down, so do not use in production.
$ strace -e openat ls$ strace -p 1234$ ltrace ./a.outShow or set per-process resource limits
Built-in. Common values: `-n` (open files), `-u` (max processes), `-t` (cpu seconds), `-v` (virtual memory). Adjusts limits for the current shell.
$ ulimit -n$ ulimit -n 4096$ ulimit -aShow recent commands
Prints the in-memory history of commands you have run in the current sandbox session, numbered so you can refer to them.
$ history$ history | tail -n 5Show most-used commands from this session
Tallies how many times each command appears in the current session’s history and ranks them. Great for spotting your habits.
$ history_statsShow short help for a command
Like `help` but for one command at a time. Prints a small man-page-style summary (NAME, SYNOPSIS, DESCRIPTION).
$ man ls$ man grepChain commands with ;, &&, ||, and pipe with |
The Learninx shell supports the four classic control operators. `;` runs unconditionally. `&&` runs the right side only if the left side succeeded. `||` runs only on failure. `|` passes the left side’s stdout into the right side’s stdin.
$ ls && echo done$ cat file | grep error$ false || echo "fell through"$ echo a ; echo bList available commands
Prints the full list of sandbox commands with one-line descriptions.
$ helpShow running processes (read-only)
In the sandbox this prints a static snapshot of process activity. The full interactive `top` is not available in the in-browser shell.
$ topExplain how a name would be interpreted
Tells you whether a name is a builtin, an alias, a function, or an external command on `$PATH`. In a real shell: `type -a cd` shows all matches.
$ type cd$ type ls$ type -a echoDefine / remove a command shortcut
`alias ll="ls -la"` defines a shortcut for the current shell. Add it to `~/.bashrc` to persist. `unalias ll` removes it.
$ alias ll="ls -la"$ alias gs="git status"$ unalias llRun a script in the current shell
`source script.sh` (or its short form `. script.sh`) executes the file in the current shell, so its `export`s and `cd` stick. Without it, the script runs in a subshell.
$ source ~/.bashrc$ . ./env.shSet or remove shell variables / options
Builtin. `set -e` aborts on any error, `set -u` errors on undefined variables, `set -x` prints each command before running. `set` alone lists all variables. `unset NAME` removes one.
$ set -e$ set -euxo pipefail$ set +e$ unset FOOShow / clear the remembered $PATH cache
Bash caches the location of recently used commands. `hash` shows the cache; `hash -r` clears it (force re-resolution from `$PATH`). Useful after installing a new tool.
$ hash$ hash -r$ hash -t lsFix Command — edit & re-run a previous command
`fc` opens your last command in `$EDITOR`; save and quit to run it. `fc -l` lists recent commands (similar to history). Handy for editing long pipelines.
$ fc$ fc -l$ fc 50 60Wait for background jobs to finish
`wait` blocks until all background children of the current shell exit. `wait %1` waits for job #1. Returns the exit status of the waited-on job.
$ sleep 10 &$ wait$ wait %1