Skip to content
~/cheatsheet

Cheatsheet

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.

Navigation

4

pwd

Navigation

Print working directory

Shows the absolute path of the directory you are currently in.

Examples
  • $ pwd

cd

Navigation

Change 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.

Examples
  • $ cd projects
  • $ cd ..
  • $ cd ~
  • $ cd /tmp

ls

Navigation

List 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).

Examples
  • $ ls
  • $ ls -l
  • $ ls -la
  • $ ls /etc

pushd / popd / dirs

Navigation

Directory 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.

Examples
  • $ pushd projects
  • $ popd
  • $ dirs

Files

15

mkdir

Files

Make a directory

Creates a new directory. `-p` (parents) creates any missing intermediate directories and silently succeeds if the target already exists.

Examples
  • $ mkdir lab
  • $ mkdir -p a/b/c

touch

Files

Create 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.

Examples
  • $ touch notes.txt

cp

Files

Copy files and directories

Copies a file to a new location. `-r` is required to copy a directory recursively.

Examples
  • $ cp notes.txt copy.txt
  • $ cp -r src backup

mv

Files

Move 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.

Examples
  • $ mv notes.txt renamed.txt
  • $ mv report.txt archive/

rm

Files

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.

Examples
  • $ rm notes.txt
  • $ rm -r lab
  • $ rm -rf build

rmdir

Files

Remove empty directories

Like `rm -r`, but refuses to delete a directory that still contains files. Safer for scripts.

Examples
  • $ rmdir old-logs
  • $ rmdir -p a/b/c

install

Files

Copy 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.

Examples
  • $ install -D src/header.h /usr/include/header.h

mktemp

Files

Create 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.

Examples
  • $ mktemp
  • $ mktemp tmp.XXXXXXXX

truncate

Files

Shrink 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.

Examples
  • $ truncate -s 0 app.log
  • $ truncate -s 1M image.bin

du

Files

Estimate 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.

Examples
  • $ du -sh projects
  • $ du -h --max-depth=1

fileinfo

Files

Show 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.

Examples
  • $ fileinfo notes.txt

ln

Files

Create 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.

Examples
  • $ ln -s config.txt config.link

rsync

Files

Fast 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.

Examples
  • $ rsync -av src/ backup/
  • $ rsync -av --delete src/ dest/

rename

Files

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.

Examples
  • $ rename "s/.txt/.md/" *.txt
  • $ rename "y/a-z/A-Z/" *.txt

Inspection

18

tree

Inspection

Display a directory tree

Renders a pretty ASCII tree of the directory starting at the given path. Pure visualisation — no flags supported in the sandbox.

Examples
  • $ tree
  • $ tree projects

stat

Inspection

Display file status

Prints size, permissions, inode (simulated) and modification time. Verbose alternative to `ls -l`.

Examples
  • $ stat notes.txt
  • $ stat /etc/passwd

file

Inspection

Determine file type

Sniffs the contents and prints what kind of file it is: ASCII text, empty, directory, or which interpreter a `#!/...` shebang points to.

Examples
  • $ file notes.txt
  • $ file /usr/bin/ls

basename

Inspection

Strip the directory part of a path

Prints only the final filename component. Useful in shell loops over `find` results.

Examples
  • $ basename /etc/nginx/nginx.conf

dirname

Inspection

Strip the last component of a path

Prints everything except the final filename component — the directory portion of the path.

Examples
  • $ dirname /etc/nginx/nginx.conf

realpath

Inspection

Print the resolved absolute path

Resolves any `.`, `..`, or relative segments and prints a clean absolute path.

Examples
  • $ realpath ../notes.txt
  • $ realpath ~/projects

diff

Inspection

Compare 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)`.

Examples
  • $ diff old.txt new.txt

tail

Inspection

Show 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.

Examples
  • $ tail notes.txt
  • $ tail -n 5 /var/log/syslog

md5sum

Inspection

Print 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.)

Examples
  • $ md5sum *.iso

sha256sum

Inspection

Print 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.)

Examples
  • $ sha256sum backup.tar

strings

Inspection

Print printable strings (≥4 chars) from a file

Pulls out runs of printable ASCII at least 4 characters long. Classic tool for inspecting binary blobs.

Examples
  • $ strings app.bin | less

od

Inspection

Dump 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.

Examples
  • $ od -c notes.txt
  • $ od -x notes.txt

xxd

Inspection

Hex dump of a file

Prints a hex+ASCII view of the file, 16 bytes per line. Useful for inspecting binary data and reverse engineering.

Examples
  • $ xxd app.bin | head

cat

Inspection

Print the contents of a file

Writes the file to standard output. Great for short files. For longer files prefer `less` or `head` / `tail`.

Examples
  • $ cat notes.txt
  • $ cat /etc/hostname

head

Inspection

Show the first lines of a file

By default prints the first 10 lines. Pass `-n` to change the count.

Examples
  • $ head notes.txt
  • $ head -n 5 /etc/passwd

wc

Inspection

Count lines, words and bytes

By default prints three numbers: lines, words, bytes. Common flags: `-l` (lines only), `-w` (words only), `-c` (bytes only).

Examples
  • $ wc notes.txt
  • $ wc -l notes.txt

stat (extended)

Inspection

Use 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.

Examples
  • $ stat -c "%a %n" notes.txt
  • $ stat -c "%s" image.png

less / more

Inspection

Page 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`.

Examples
  • $ less notes.txt
  • $ more /etc/services

Editing

8

printf

Editing

Format 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.

Examples
  • $ printf "hello %s\n" world
  • $ printf "%d + %d = %d\n" 1 2 3

yes

Editing

Print 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.

Examples
  • $ yes
  • $ yes "I agree" | head -n 3

echo

Editing

Print text to the screen

Writes its arguments to standard output. Combine with `>` to write to a file or `>>` to append.

Examples
  • $ echo hello
  • $ echo hello > notes.txt
  • $ echo more >> notes.txt

nano

Editing

Beginner-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.

Examples
  • $ nano notes.txt

vi / vim

Editing

Modal 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.

Examples
  • $ vi notes.txt
  • $ vim notes.txt

read

Editing

Read 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.

Examples
  • $ read -p "Name? " name
  • $ read -s -p "Password: " pw

test / [ ]

Editing

Evaluate 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.

Examples
  • $ [ -f notes.txt ] && echo yes
  • $ [ "$x" = "y" ]
  • $ [ -d /tmp ]

exec

Editing

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.

Examples
  • $ exec vim notes.txt
  • $ exec > log.txt 2>&1

Text

26

sort

Text

Sort lines of text (supports -r -n -u)

Orders lines alphabetically by default. `-n` sorts numerically, `-r` reverses, `-u` keeps only unique lines.

Examples
  • $ sort names.txt
  • $ sort -nr scores.txt
  • $ sort -u tags.txt

uniq

Text

Remove 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.

Examples
  • $ uniq -c access.log
  • $ sort tags.txt | uniq

cut

Text

Cut 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.

Examples
  • $ cut -d: -f1 /etc/passwd
  • $ cut -c1-10 file.txt

tr

Text

Translate 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.

Examples
  • $ tr a-z A-Z < file.txt
  • $ tr -d "\r" < dos.txt

tac

Text

Print lines in reverse order

Reads a file and prints its lines from bottom to top. `cat` reversed, character-by-character.

Examples
  • $ tac notes.txt

rev

Text

Reverse each line of input

Reads input and prints each line with its characters in reverse order. Lines themselves stay in order.

Examples
  • $ rev names.txt

nl

Text

Number 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.

Examples
  • $ nl notes.txt
  • $ cat notes.txt | nl

paste

Text

Merge 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).

Examples
  • $ paste names.txt phones.txt
  • $ paste -d, a.csv b.csv

join

Text

Join 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.

Examples
  • $ join users.txt groups.txt

sed

Text

Stream 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.

Examples
  • $ sed "s/old/new/g" notes.txt
  • $ sed 's/foo/bar/' file.txt

awk

Text

Simple 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.

Examples
  • $ awk "{print $1}" access.log
  • $ awk "{print $0}" notes.txt

base64

Text

base64 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.

Examples
  • $ base64 photo.png
  • $ base64 -d ciphertext.txt

tee

Text

Read 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.

Examples
  • $ echo hello | tee out.txt
  • $ cat log | tee -a all.log | grep ERROR

xargs

Text

Build 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.

Examples
  • $ find . -name "*.log" | xargs rm
  • $ echo "a b c" | xargs echo item:

column

Text

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.

Examples
  • $ cat data.txt | column -t
  • $ cut -d: -f1,6 /etc/passwd | column -t -s:

expand / unexpand

Text

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.

Examples
  • $ expand notes.txt
  • $ unexpand -t 4 notes.txt

fmt

Text

Reformat 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.

Examples
  • $ fmt notes.txt
  • $ fmt -w 80 essay.md

fold

Text

Wrap 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.

Examples
  • $ fold -w 40 notes.txt
  • $ fold -w 80 -s long.txt

pr

Text

Paginate 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.

Examples
  • $ pr notes.txt
  • $ pr -l 20 -w 60 essay.md

shuf

Text

Shuffle 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.

Examples
  • $ shuf names.txt
  • $ shuf -n 1 names.txt
  • $ shuf -i 1-100 -n 5

seq

Text

Print 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.

Examples
  • $ seq 5
  • $ seq 1 2 10
  • $ seq -w 1 10

factor

Text

Prime-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.

Examples
  • $ factor 60
  • $ factor 17
  • $ echo 1024 | factor

comm

Text

Compare 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.

Examples
  • $ comm a.txt b.txt
  • $ comm -12 a.txt b.txt

tsort

Text

Topological 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.

Examples
  • $ tsort deps.txt
  • $ echo -e "b a\nc b" | tsort

iconv

Text

Convert 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.

Examples
  • $ iconv -f UTF-8 -t ISO-8859-1 notes.txt
  • $ iconv -l

xargs (advanced)

Text

Use -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`).

Examples
  • $ find . -name "*.log" -print0 | xargs -0 rm
  • $ echo a b c | xargs -n1 echo got:

Search

9

find

Search

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.

Examples
  • $ find .
  • $ find /etc -name "*.conf"

grep

Search

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.

Examples
  • $ grep error app.log
  • $ grep -in "TODO" notes.txt
  • $ cat app.log | grep 500

locate

Search

Find 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.

Examples
  • $ locate nginx.conf
  • $ locate -i readme.md

whereis

Search

Locate 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.

Examples
  • $ whereis ls
  • $ whereis grep

rg (ripgrep)

Search

Fast 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.

Examples
  • $ rg TODO src/
  • $ rg -i error logs/
  • $ rg -n "fn main" .

ag (silver searcher)

Search

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.

Examples
  • $ ag TODO src/
  • $ ag -i error logs/

ack

Search

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.

Examples
  • $ ack TODO src/
  • $ ack --perl "\bTODO\b"

fgrep

Search

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.

Examples
  • $ grep -F "error: file not found" logs.txt
  • $ fgrep "[INFO]" app.log

egrep

Search

grep 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`.

Examples
  • $ grep -E "err|warn" app.log
  • $ egrep "^[A-Z]+$" tokens.txt

Permissions

14

groups

Permissions

Print group memberships for a user

With no argument, lists the groups of the current user. With a username, lists that user’s groups.

Examples
  • $ groups
  • $ groups root

id

Permissions

Print user identity

Prints the numeric UID, primary GID and the full list of group memberships for the current user.

Examples
  • $ id
  • $ id root

sudo

Permissions

Run 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.

Examples
  • $ sudo apt update
  • $ sudo systemctl restart nginx

chmod

Permissions

Change file permissions

Updates the read / write / execute bits. The octal form is easiest: 7 = rwx, 6 = rw-, 5 = r-x, 4 = r--, 0 = ---.

Examples
  • $ chmod +x script.sh
  • $ chmod 755 script.sh
  • $ chmod 600 secret.txt

ps

Permissions

List running processes

Shows the processes started in the current sandbox shell. Informational only — you cannot kill other sessions.

Examples
  • $ ps

chown

Permissions

Change 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.

Examples
  • $ chown learner notes.txt
  • $ chown learner:staff notes.txt
  • $ chown -R root /etc/app

chgrp

Permissions

Change 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.

Examples
  • $ chgrp staff notes.txt
  • $ chgrp -R devs project/

umask

Permissions

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.

Examples
  • $ umask
  • $ umask 077

chattr / lsattr

Permissions

Change / 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.

Examples
  • $ chattr +i /etc/passwd
  • $ lsattr notes.txt

su

Permissions

Switch 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.

Examples
  • $ su
  • $ su - learner
  • $ su -c "apt update" root

passwd

Permissions

Change a user password

With no argument, changes the current user’s password. As root, `passwd learner` resets another user’s. Sandbox informational.

Examples
  • $ passwd
  • $ passwd learner

useradd / userdel / usermod

Permissions

Manage 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.

Examples
  • $ useradd -m alice
  • $ usermod -aG sudo alice
  • $ userdel -r alice

groupadd / groupdel

Permissions

Add or remove groups

`groupadd devs` creates a group, `groupdel devs` removes one. Pair with `usermod -aG` to add users to it.

Examples
  • $ groupadd devs
  • $ groupdel devs

visudo

Permissions

Safely 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.

Examples
  • $ visudo
  • $ visudo -f /etc/sudoers.d/devs

Network

15

ifconfig

Network

Show network interfaces

Older but still-common tool for inspecting IP addresses, MAC addresses and packet counts per interface. (`ip addr` is the modern equivalent.)

Examples
  • $ ifconfig
  • $ ifconfig eth0

ip

Network

Show / 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.

Examples
  • $ ip addr
  • $ ip a

ping

Network

Ping a host (simulated)

Sends ICMP echo requests to a host and reports round-trip times. The sandbox simulates a successful three-packet exchange.

Examples
  • $ ping learninx.dev
  • $ ping -c 3 1.1.1.1

curl

Network

Fetch a URL (simulated)

Pretends to make an HTTP request. `-I` / `--head` returns just the response headers; without it, returns a small HTML stub.

Examples
  • $ curl https://learninx.dev
  • $ curl -I https://learninx.dev

wget

Network

Download a URL to disk (simulated)

Like `curl`, but writes the response to a file by default. Sandbox reports a successful download with byte count.

Examples
  • $ wget https://learninx.dev/index.html

ssh

Network

Open a remote shell (simulated)

Pretends to log into the given host (format `user@host`) and prints a sample welcome banner.

Examples
  • $ ssh learner@learninx.dev
  • $ ssh root@server.local

nslookup / dig

Network

DNS 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.

Examples
  • $ dig learninx.dev
  • $ nslookup learninx.dev
  • $ dig +short MX gmail.com

traceroute

Network

Show 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.

Examples
  • $ traceroute learninx.dev
  • $ traceroute -n 1.1.1.1

netstat / ss

Network

Show 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).

Examples
  • $ ss -tuln
  • $ netstat -tulnp
  • $ ss -s

scp

Network

Secure 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.

Examples
  • $ scp notes.txt learner@server:~/notes.txt
  • $ scp -r ./project learner@server:~/

sftp

Network

Interactive FTP over SSH

Starts an interactive session for browsing and transferring files on a remote host. Commands: `get`, `put`, `ls`, `cd`, `bye`.

Examples
  • $ sftp learner@server
  • $ sftp -P 2222 learner@server

telnet

Network

Talk 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.

Examples
  • $ telnet learninx.dev 80
  • $ telnet mail.example.com 25

nc (netcat)

Network

Swiss-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.

Examples
  • $ nc -lv 8080
  • $ nc -zv learninx.dev 443
  • $ echo hello | nc learninx.dev 80

ip (extended)

Network

Routes, 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`.

Examples
  • $ ip route
  • $ ip link
  • $ ip neigh

ss -tunap

Network

List 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.

Examples
  • $ ss -tunap
  • $ ss -tunap

Archiving

10

tar

Archiving

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.

Examples
  • $ tar -czf backup.tgz project/
  • $ tar -xzf backup.tgz
  • $ tar -tzf backup.tgz
  • $ tar -cjf backup.tar.bz2 project/

gzip / gunzip

Archiving

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.

Examples
  • $ gzip notes.txt
  • $ gunzip notes.txt.gz
  • $ gzip -k big.log

bzip2 / bunzip2

Archiving

Higher-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`.

Examples
  • $ bzip2 big.log
  • $ bunzip2 big.log.bz2

xz / unxz

Archiving

LZMA compression — often the smallest (.xz)

Modern, high-ratio compressor. Common extension `.tar.xz` (used by many Linux kernel releases). Slower than gzip.

Examples
  • $ xz image.iso
  • $ unxz image.iso.xz

zip / unzip

Archiving

Cross-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.

Examples
  • $ zip -r project.zip project/
  • $ unzip project.zip -d ./out
  • $ unzip -l project.zip

7z / 7zz

Archiving

7-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.

Examples
  • $ 7z a backup.7z project/
  • $ 7z x backup.7z
  • $ 7z l backup.7z

unzip (flags)

Archiving

Selective 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.

Examples
  • $ unzip -l archive.zip
  • $ unzip -d ./out archive.zip
  • $ unzip -p archive.zip readme.txt

tar (advanced)

Archiving

Exclude 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.

Examples
  • $ tar -czf out.tgz --exclude="*.log" project/
  • $ tar -xzf in.tgz --strip-components=1
  • $ tar -cf - src/ | ssh user@host "tar -xf - -C /dest"

cpio

Archiving

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.

Examples
  • $ find . | cpio -o > archive.cpio
  • $ cpio -id < archive.cpio

zcat / zless / zgrep

Archiving

Operate 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.

Examples
  • $ zcat app.log.gz
  • $ zless app.log.gz
  • $ zgrep ERROR app.log.gz

System

46

env

System

Print 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.

Examples
  • $ env
  • $ env | grep PATH

export

System

Set 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.

Examples
  • $ export EDITOR=vim
  • $ export PATH="$HOME/bin:$PATH"

exit

System

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.

Examples
  • $ exit

sleep

System

Pause for N seconds (simulated)

Real `sleep` waits in real time. The sandbox returns immediately so your lesson does not stall.

Examples
  • $ sleep 1
  • $ sleep 0.5 && echo done

true

System

Do nothing, successfully

Exits with status 0 and produces no output. Mostly useful in shell scripts: `while true; do ...; done`.

Examples
  • $ true

false

System

Do nothing, unsuccessfully

Exits with a non-zero status and produces no output. Useful for testing `&&` / `||` chains.

Examples
  • $ false || echo "fell through"

arch

System

Print machine architecture

Always reports `x86_64` in the sandbox. In real Linux it returns the CPU architecture of the host.

Examples
  • $ arch

nproc

System

Print the number of processing units available

Returns the number of logical CPU cores. The sandbox reports 4. Used in build scripts to parallelise jobs.

Examples
  • $ nproc
  • $ make -j$(nproc)

lsblk

System

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.

Examples
  • $ lsblk
  • $ lsblk -f

lscpu

System

Display CPU architecture information

Detailed dump of CPU model, cores, threads, cache sizes and feature flags. Sandbox returns a representative sample.

Examples
  • $ lscpu

lsmem

System

List 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.

Examples
  • $ lsmem

lsof

System

List 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.

Examples
  • $ lsof
  • $ lsof /etc/passwd

dmesg

System

Print 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.

Examples
  • $ dmesg
  • $ dmesg | grep -i usb

last

System

Show last logged-in users (simulated)

Reads `/var/log/wtmp` (sandbox: a small static sample) and prints the recent login history, with session durations.

Examples
  • $ last
  • $ last learner

who

System

Show who is logged on

Prints one line per currently logged-in user: username, terminal, login time, and remote host (in parentheses).

Examples
  • $ who
  • $ who -b

logname

System

Return the user's login name

Prints the account name that was used to log into the current session, even after a `su` switch.

Examples
  • $ logname

vmstat

System

Report virtual memory statistics

A one-line snapshot of process, memory, swap, I/O and CPU activity. Sandbox returns a representative line.

Examples
  • $ vmstat
  • $ vmstat 2

iostat

System

Report CPU and I/O statistics

Per-device and CPU utilisation numbers — useful for spotting I/O bottlenecks. Sandbox returns a representative table.

Examples
  • $ iostat
  • $ iostat -xz 2

kill

System

Send 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.

Examples
  • $ kill 1234
  • $ kill -9 1234

which

System

Locate 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.

Examples
  • $ which ls
  • $ which python

nohup

System

Run 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.

Examples
  • $ nohup ./long-job.sh &

uname

System

Print system information

Prints the kernel name. `-a` includes the version, architecture and hostname.

Examples
  • $ uname
  • $ uname -a

uptime

System

Show how long the system has been up

Prints a short uptime line. In the sandbox this is a simulated value.

Examples
  • $ uptime

free

System

Show memory usage

Prints total, used and free memory. `-h` switches to human-readable units (K, M, G).

Examples
  • $ free
  • $ free -h

df

System

Show disk space usage

Reports the filesystem disk space usage. `-h` switches to human-readable units.

Examples
  • $ df
  • $ df -h

whoami

System

Print the current user

Writes your current username. In the sandbox you are always `learner`.

Examples
  • $ whoami

hostname

System

Print the system hostname

Writes the name of the current machine.

Examples
  • $ hostname

date

System

Show the current date and time

Prints the current local date and time.

Examples
  • $ date

clear

System

Clear the terminal

Scrolls the terminal so the prompt sits at the top of the visible area. Shortcut: Ctrl+L.

Examples
  • $ clear

sync

System

Flush 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.

Examples
  • $ sync

systemctl

System

Control 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.

Examples
  • $ systemctl status nginx
  • $ sudo systemctl restart sshd
  • $ systemctl enable --now cron

service

System

SysV-style service control

Older interface (`service nginx restart`) still works on most distros thanks to systemd compatibility shims. Prefer `systemctl` on new systems.

Examples
  • $ service nginx status
  • $ sudo service ssh restart

journalctl

System

Read 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.

Examples
  • $ journalctl -u nginx -f
  • $ journalctl -p err --since today
  • $ journalctl --list-boots

crontab

System

Schedule recurring jobs

Edit with `crontab -e`, list with `crontab -l`. A line is `m h dom mon dow command`. `@reboot`, `@daily` etc. are shortcuts.

Examples
  • $ crontab -l
  • $ crontab -e
  • $ */5 * * * * /opt/job.sh

at

System

Schedule 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.

Examples
  • $ at 14:00
  • $ atq
  • $ atrm 3

shutdown / reboot / halt / poweroff

System

Stop, 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.

Examples
  • $ sudo shutdown -h now
  • $ sudo reboot
  • $ sudo shutdown -r +5 "kernel update"

init / runlevel / telinit

System

Legacy init control (SysV)

`init 0` halts, `init 6` reboots, `runlevel` prints the current and previous level. Largely replaced by `systemctl`. Sandbox informational.

Examples
  • $ runlevel
  • $ sudo init 6

bg / fg / jobs / disown

System

Job 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.

Examples
  • $ sleep 60 &
  • $ jobs
  • $ fg %1
  • $ Ctrl+Z then bg %1

nice / renice

System

Run 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.

Examples
  • $ nice -n 10 make
  • $ sudo renice -n -5 -p 1234

time

System

Measure 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.

Examples
  • $ time find / -name "*.log"
  • $ /usr/bin/time -v make

timeout

System

Run 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.

Examples
  • $ timeout 5s ping 8.8.8.8
  • $ timeout --signal=KILL 30s ./build.sh

watch

System

Re-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.

Examples
  • $ watch -n 2 "df -h"
  • $ watch -d ls /tmp

lspci / lsusb / lsmod

System

List 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.

Examples
  • $ lspci
  • $ lsusb
  • $ lsmod

modprobe / rmmod / insmod

System

Load / 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.

Examples
  • $ sudo modprobe br_netfilter
  • $ sudo rmmod br_netfilter
  • $ sudo insmod /lib/modules/.../mymod.ko

strace / ltrace

System

Trace 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.

Examples
  • $ strace -e openat ls
  • $ strace -p 1234
  • $ ltrace ./a.out

ulimit

System

Show 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.

Examples
  • $ ulimit -n
  • $ ulimit -n 4096
  • $ ulimit -a

Help

13

history

Help

Show recent commands

Prints the in-memory history of commands you have run in the current sandbox session, numbered so you can refer to them.

Examples
  • $ history
  • $ history | tail -n 5

history_stats

Help

Show 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.

Examples
  • $ history_stats

man

Help

Show short help for a command

Like `help` but for one command at a time. Prints a small man-page-style summary (NAME, SYNOPSIS, DESCRIPTION).

Examples
  • $ man ls
  • $ man grep

chain

Help

Chain 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.

Examples
  • $ ls && echo done
  • $ cat file | grep error
  • $ false || echo "fell through"
  • $ echo a ; echo b

help

Help

List available commands

Prints the full list of sandbox commands with one-line descriptions.

Examples
  • $ help

top

Help

Show 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.

Examples
  • $ top

type

Help

Explain 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.

Examples
  • $ type cd
  • $ type ls
  • $ type -a echo

alias / unalias

Help

Define / 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.

Examples
  • $ alias ll="ls -la"
  • $ alias gs="git status"
  • $ unalias ll

source / .

Help

Run 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.

Examples
  • $ source ~/.bashrc
  • $ . ./env.sh

set / unset

Help

Set 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.

Examples
  • $ set -e
  • $ set -euxo pipefail
  • $ set +e
  • $ unset FOO

hash

Help

Show / 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.

Examples
  • $ hash
  • $ hash -r
  • $ hash -t ls

fc

Help

Fix 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.

Examples
  • $ fc
  • $ fc -l
  • $ fc 50 60

wait

Help

Wait 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.

Examples
  • $ sleep 10 &
  • $ wait
  • $ wait %1