Skip to content

The Terminal

The terminal is your primary tool. Every hack, every scan, every connection flows through it. Type help at any time to list commands, help <cmd> for detail, or man <cmd> for the full manual page (man -k <word> searches them all).

Command What it does
help List all available commands
help <cmd> Detailed help for a specific command
man <cmd> Full manual page (man -k <word> searches them all)
clear Clear the terminal screen
echo <text> Print text, useful on the right of a pipe
whoami Who you are on the machine you are standing on
Command What it does
ssh <user>@<ip> Log in with cracked credentials, the usual way onto a box
telnet <ip> Connect to a device’s telnet service (port 23)
connect <ip> Session on Windows, AIX mainframe or mobile targets only
disconnect Return to your local machine
exit Leave a remote session or shell interpreter
Command What it does
pwd Print the directory you are standing in
ls List files in the current directory
tree Recursive tree of a path (-a hidden, -L <n> depth, -d dirs only)
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, local only)
rm <file> Delete a file
cp <src> <dst> Copy a file (cp -r for a directory)
mv <src> <dst> Move or rename a file
Command What it does
host <domain> Convert a domain to an IP
whois <domain> Registration records for a target domain

Commands can be piped together with |, just like a real shell:

Terminal window
nmap 10.0.1.1 | grep ssh
ps | grep apache | wc -l
cat /etc/passwd | sort | head -5

Built-in pipe filters: grep, head, tail, wc, sort, uniq.

When you connect to a remote server, your prompt changes to show the remote IP, and all filesystem commands (ls, cd, cat, …) operate on that machine. Use disconnect to return home.

Ready to break into something? Continue to Scanning & Stealth and The Hacking Pipeline, or jump to the full Command Reference.