A field reference for offensive security & red team operators — filesystem hierarchy, permissions, text processing, networking, SSH tradecraft, privilege escalation checklists, and the command cheat sheet every pentester relies on daily. Companion documentation for the video "Complete Linux for Hackers in 30 Minutes."
Author: Aravinda A Kumar — CRTO · OSCP+ · CEH v12 Master
Focus: Active Directory · Web/API Pentesting · Adversary Emulation
Level: Beginner → Intermediate | Format: Command reference + enumeration checklists
This reference accompanies the full "Complete Linux for Hackers in 30 Minutes" series, split across two parts:
▶️Complete Linux for Hackers — Part 1 → ▶️Complete Linux for Hackers — Part 2 →Filesystem, users, permissions, and the shell.
Text processing, networking, and SSH pivoting.
Recon toolkit and the privilege escalation checklist.
The ultimate cheat sheet and lab-building resources.
Linux underpins the infrastructure hackers actually attack and the infrastructure they attack from. Most internet-facing servers, cloud instances, containers, IoT devices, and every major pentest distribution (Kali, Parrot OS, BlackArch) run on Linux. Fluency here isn't optional — it's the baseline.
Linux organizes everything under a single root /. Knowing what lives where tells you instantly where to look for credentials, configs, logs, and privilege escalation vectors.
| Path | What it holds |
|---|---|
/etc | System-wide configuration files — passwd, shadow, crontab, service configs. Prime recon target. |
/home | User home directories — often contain SSH keys, shell history, and stray credentials. |
/root | The root user's home directory. Readable only by root — getting here usually means you've won. |
/var/log | System and application logs. Essential for post-exploitation timeline building. |
/tmp, /var/tmp | World-writable scratch space — common staging ground for payloads and exploit compilation. |
/proc | A virtual filesystem exposing live kernel and process information in real time. |
/usr/bin, /bin | Executable binaries available to all users. |
/opt | Third-party or manually installed software — frequently misconfigured. |
/dev | Device files representing hardware and virtual devices. |
find / -writable -type d 2>/dev/null early in an engagement tells you exactly where you're allowed to drop files — invaluable during privesc.Linux permissions are the first wall between a foothold and full compromise. Every file has an owner, a group, and a permission triad (read/write/execute) for owner, group, and others.
$ ls -l /etc/shadow
-rw-r----- 1 root shadow 1520 Jul 24 09:14 /etc/shadow
$ id
uid=1000(alex) gid=1000(alex) groups=1000(alex),27(sudo),999(docker)
Reading permission strings: rwxr-xr-- breaks down as: owner has read/write/execute, group has read/execute, others have read-only. Numerically this is 754 (4=read, 2=write, 1=execute, summed per triad).
| Path | What it does |
|---|---|
/etc/passwd | User account list — readable by everyone. Reveals valid usernames and shells. |
/etc/shadow | Hashed passwords — root-only. A prime privesc/exfil target if readable. |
/etc/group | Group memberships. Membership in docker, lxd, or disk groups can enable privesc. |
/etc/sudoers | Defines who can run what as root via sudo. Check with sudo -l first. |
docker or lxd group without root is functionally equivalent to root — both let you mount the host filesystem into a container you control. Always check group membership.Almost every enumeration task boils down to filtering text. These four tools handle nearly all of it.
grep -i 'password' config.php # case-insensitive match
grep -rn 'API_KEY' /var/www/ # recursive, show line numbers
grep -E '[0-9]{1,3}(\.[0-9]{1,3}){3}' file # extended regex, e.g. IPs
find / -perm -4000 -type f 2>/dev/null # SUID binaries — classic privesc hunt
find / -writable -type f 2>/dev/null # world-writable files
find / -name '*.conf' -mtime -7 # config files modified in last 7 days
sed 's/foo/bar/g' file.txt # replace all 'foo' with 'bar'
sed -n '10,20p' file.txt # print lines 10-20
awk -F: '{print $1}' /etc/passwd # print first field (usernames)
awk '$3 > 1000 {print $1}' /etc/passwd # users with UID over 1000
| Command | What it does |
|---|---|
ps aux | List all running processes with owner, CPU, and memory usage. |
ps -ef --forest | Show the process tree — useful for spotting parent/child exploitation chains. |
top / htop | Live view of resource usage per process. |
kill -9 <pid> | Force-terminate a process. |
systemctl status <svc> | Check a systemd service's state. |
systemctl list-units --type=service | Enumerate all active services — attack surface mapping. |
journalctl -u <svc> -f | Follow live logs for a specific systemd service. |
crontab -l | List scheduled jobs for the current user — common persistence & privesc vector. |
cat /etc/crontab | Check system-wide scheduled tasks. |
| Command | What it does |
|---|---|
apt update && apt install <pkg> | Debian/Ubuntu/Kali — refresh index and install a package. |
apt list --installed | List installed packages — useful for spotting outdated/vulnerable software. |
dnf install <pkg> | Fedora/RHEL-based systems. |
pacman -S <pkg> | Arch/BlackArch package installation. |
dpkg -l | grep <name> | Query installed Debian packages directly. |
snap list | List installed snap packages — another enumeration surface. |
| Command | What it does |
|---|---|
ip a | Show all network interfaces and assigned addresses. |
ip route | Display the routing table. |
ss -tulnp | Show listening TCP/UDP ports and owning processes (modern replacement for netstat). |
curl -I https://target | Fetch HTTP headers only — quick fingerprinting. |
dig target.com ANY | DNS enumeration — records, mail servers, etc. |
nc -lvnp 4444 | Netcat listener — commonly used to catch reverse shells in a lab. |
nc -zv target 1-1000 | Basic TCP port sweep with netcat. |
tcpdump -i eth0 -w cap.pcap | Capture live traffic on an interface to a pcap file. |
iptables -L -n -v | List current firewall rules. |
ip a, ss -tulnp, and iptables -L early — it anchors your understanding of what the box can reach and what's listening on it.| Command | What it does |
|---|---|
ssh user@host | Basic interactive SSH connection. |
ssh -i key.pem user@host | Authenticate with a specific private key. |
ssh -L 8080:localhost:80 user@host | Local port forward — tunnel a remote service to your machine. |
ssh -D 9050 user@host | Dynamic SOCKS proxy — pivot traffic through the target. |
scp file user@host:/path | Copy a file to a remote host over SSH. |
ssh-keygen -t ed25519 | Generate a modern SSH keypair. |
ssh-copy-id user@host | Push your public key to a remote host's authorized_keys. |
-L / -R / -D) is the single most useful pivoting skill in this document. If you only master one networking trick, master dynamic port forwarding for pivoting through a foothold.Scripting turns one-off commands into repeatable enumeration and automation. A few patterns cover 80% of what you'll write in the field.
#!/bin/bash
# Simple host sweep for live IPs on a /24
for i in $(seq 1 254); do
ip="192.168.1.$i"
ping -c1 -W1 "$ip" &>/dev/null && echo "$ip is up"
done
name="world"
if [ -f /etc/passwd ]; then echo "file exists"; fi
while read -r line; do echo "$line"; done < list.txt
for f in *.txt; do echo "$f"; done
"$var" not $var) and set set -euo pipefail at the top of serious scripts — it saves you from silent failures during automated recon.A curated set of tools that cover the vast majority of external and internal recon during an authorized engagement or CTF.
| Command | What it does |
|---|---|
nmap -sC -sV -oA scan target | Default scripts + version detection, output in all formats. |
nmap -p- --min-rate=5000 target | Full TCP port sweep, fast. |
gobuster dir -u url -w wordlist | Directory/file brute-forcing on a web target. |
nikto -h target | Automated web server vulnerability scanner. |
whatweb target | Fingerprint web technologies in use. |
enum4linux -a target | SMB/NetBIOS enumeration against Windows/Samba hosts. |
smbclient -L //target/ | List available SMB shares. |
crackmapexec smb target -u '' -p '' | Sweep credentials/shares across a network via SMB. |
hydra -l user -P wordlist ssh://target | Online credential brute-forcing (lab/authorized use only). |
searchsploit <keyword> | Offline search of the Exploit-DB database for known CVEs. |
Roughly in the order most operators run it once they land a low-privilege shell in a lab or authorized engagement.
id, sudo -luname -a, cat /etc/os-release — check against known kernel exploitsfind / -perm -4000 -o -perm -2000 2>/dev/null — cross-reference against GTFOBinsls -la /etc/passwd /etc/shadowcat /etc/crontab, check scripts they call for writable pathsgetcap -r / 2>/dev/null — binaries with elevated capabilitiesUnderstanding what a system logs is essential both for blue-team detection engineering and for writing an accurate, defensible pentest report.
| Path / Command | What it does |
|---|---|
/var/log/auth.log (Debian) | Authentication attempts, sudo usage, SSH logins. |
/var/log/secure (RHEL) | Equivalent auth log on Red Hat-based systems. |
/var/log/syslog | General system activity log. |
last / lastb | Show successful and failed login history. |
~/.bash_history | Command history — a goldmine and a liability for defenders and attackers alike. |
auditd / ausearch | Detailed kernel-level audit logging where configured. |
| Command | What it does |
|---|---|
whoami; hostname; uname -a | Quick environment fingerprint on landing a shell. |
history -c | Clear shell history (lab hygiene / cleanup awareness). |
python3 -m http.server 8000 | Spin up a quick HTTP server to transfer files/tools. |
wget http://host/file -O out | Download a file over HTTP. |
base64 -w0 file | Base64-encode a file for easy copy/paste transfer. |
tar czvf archive.tar.gz dir/ | Compress a directory. |
md5sum file / sha256sum file | Generate a hash for file integrity verification. |
df -h | Disk usage per mounted filesystem. |
du -sh * | sort -rh | Find the largest files/directories in the current path. |
watch -n1 'command' | Re-run a command every second — handy for monitoring. |
xargs -I{} cmd {} | Pipe a list of items into repeated command execution. |
chmod +x script.sh | Make a script executable. |
Everything in this document is meant to be practiced against systems you control.