Skip to content

Unix Commands

Standard Unix utilities, available on both your local machine and the remote boxes you land on. These are the everyday tools; for the attack-specific commands see the Command Reference, and for the terminal basics see The Terminal. Every command here has a full manual page: man <command>, and man -k <keyword> searches them when you do not know the name.

Command What it does
pwd Print the directory you are standing in
ls List directory contents
tree Recursive ls, drawn as a tree (no log, no heat): -a hidden, -L <n> depth (max 20), -d dirs only, -f full paths. Colour drops when piped
cd <dir> Change directory
cat <file> Read a file’s contents
nano <file> Edit a file
mkdir <dir> Create a directory (-p makes parents too)
cp <src> <dst> Copy a file (-r for a directory)
mv <src> <dst> Move or rename
rm <file> Delete a file
shred <file> Securely wipe a file (overwrite, then delete)
Command What it does
hostname Display the machine’s hostname
id Show current user and group IDs
uname System / kernel information
uptime How long the system has been running
neofetch NODE OS readout: rig, uptime, network, status (alias: nodefetch)
man <cmd> Manual page for a command; man -k <keyword> searches (apropos)
Command What it does
ps List running processes
kill <pid> Kill a process by its numeric PID (from ps) or its PID file. PID files live in /var/run/ and /proc/<pid>/, for example kill /var/run/nginx.pid
df Disk usage statistics
free Memory usage statistics
lsof List open files and network connections
Command What it does
whoami Who you are on the machine you are standing on
who Show logged-in users
w Detailed user session info
last Recent login history
Command What it does
grep <pattern> Search text for a pattern (-i ignore case, -v invert)
find <path> Search for files by name
history Command history

history lists what you have typed. Press Up and Down to step through it, or Ctrl+R to search as you type, just like a real shell: the prompt becomes (reverse-i-search)`ssh': ssh root@10.0.0.5. Press Ctrl+R again for the next older match, Enter to run it, or Esc to cancel. See Keyboard Shortcuts for the full list.

Shortcuts for commands you type a lot, like a real shell. Define one with alias name='command', then the name runs the command:

Terminal window
alias ll='ls -la' # then: ll /home runs ls -la /home
alias wallets='tree -a | grep wallet.dat'

Quote the expansion if it contains a pipe or spaces. An alias expands its first word before the command runs, and anything after it is passed along. Aliases cannot shadow a real command.

Command What it does
alias List every alias you have defined
unalias <name> Remove one (unalias -a removes all)

Aliases are saved with your settings and follow you across games. The file lives at /root/.bash_aliases on your own box; edit it by hand with nano /root/.bash_aliases and it syncs back when you save.

These five read the output of the command before them, so they only work after a |. Typing sort /etc/passwd does nothing; cat /etc/passwd | sort is the form that works.

Filter What it does
head -N First N lines (default 10)
tail -N Last N lines (default 10), newest log entries
wc -l -w -c Count lines, words, characters. `
sort -r -u Order the lines (-r reverse, -u drop duplicates)
uniq Collapse repeated ADJACENT lines only. Scattered duplicates survive, so the usual form is `
Command What it does
ifconfig Show your network interfaces (-a for all)
ss Socket statistics (listening ports)
netstat Network connections and routing
ping <host> Test network connectivity
iptables Firewall rules
host <domain> DNS lookup, turn a domain into an IP
dig <domain> DNS records (A / TXT / ANY). See DNS Recon
whois <domain> Domain registration records
telnet <ip> Connect to a device’s telnet service (port 23)

Decoders for the breadcrumbs hidden in dig TXT records. They read piped input, so chain them: dig +short d TXT | base64 -d.

Command What it does
base64 -d Decode base64 (drop -d to encode)
xxd -r -p Reverse a hex dump back to bytes
rot13 ROT13 letter rotation
Command What it does
echo <text> Print text, useful on the right of a pipe
clear Clear the terminal screen
exit Leave a remote session or shell interpreter
crontab Scheduled tasks
dmesg Kernel message buffer
Command What it does
ftp <ip> Interactive FTP: browse and get/put, file-only (see Lateral Movement)
tar -xzf <f> Extract a .tar.gz archive into /home/downloads
Command What it does
systemctl systemd services (status / start / stop / restart)
service FreeBSD rc.d services (start / stop / status)
Command What it does
download <f> Download a file from the connected server
upload <f> Upload a file to the connected server
delete <f> Delete a file on the connected server
logs View a server’s log files