■ LINUX FOR HACKERS
From Zero to Command-Line Hero
MODULE 1 OF 5 · LINUX FUNDAMENTALS
What is Linux?
Linux is a free, open-source operating system kernel first created by Linus Torvalds in
1991. Today it powers everything from Android phones to supercomputers — and it's the #1 OS
used by hackers, penetration testers, and security researchers worldwide. Why? Because
Linux gives you total control over your system, no secrets, no hidden processes.
Why Hackers Love Linux
■ Open source — you can read, modify, and understand every line of code.
■ Powerful terminal — automate anything with shell scripts.
■ Massive tool ecosystem — Kali Linux alone ships with 600+ security tools.
■ Multi-user design — built from the ground up for networked environments.
■ Lightweight — runs comfortably on old hardware or inside virtual machines.
The Linux File System
Unlike Windows (C:\, D:\), Linux uses a single unified tree starting at / (root). Every
file and device lives somewhere under /.
COMMAND WHAT IT DOES
/bin Essential user binaries (ls, cp, mv, bash …)
/etc System-wide configuration files
/home Home directories for regular users
/root Home directory for the root (admin) user
/var Variable data — logs, mail, databases
/tmp Temporary files, cleared on reboot
/usr User programs and libraries
/proc Virtual filesystem exposing kernel internals
/dev Device files (disks, terminals, random …)
Linux for Hackers · Page 1 For educational purposes only — hack ethically!
Your First Commands
Open a terminal (Ctrl+Alt+T on most distros) and type these commands. Don't just read —
TYPE every one!
COMMAND WHAT IT DOES
pwd Print Working Directory — where am I right now?
ls List files in current directory
ls -la List ALL files with permissions and sizes
cd /etc Change Directory to /etc
cd ~ Go back to your home directory
cd .. Go up one level
clear Clear the terminal screen
whoami Print your current username
id Show user ID and group memberships
uname -a Show full kernel/OS information
■■ ROOT vs. REGULAR USER
$ at the start of a prompt = regular user (limited). # at the start = root (admin, unlimited
power). NEVER run everything as root — one typo can destroy your system.
Working with Files
COMMAND WHAT IT DOES
cat [Link] Print file contents to the screen
less [Link] Scroll through large files (q to quit)
head -20 file Show first 20 lines
tail -20 file Show last 20 lines
touch newfile Create an empty file
mkdir myfolder Create a directory
cp src dst Copy file from src to dst
mv src dst Move/rename a file
rm file Delete a file (careful — no Recycle Bin!)
rm -rf folder/ Delete a folder recursively (DANGEROUS)
find / -name "*.log" Find all .log files from root
Linux for Hackers · Page 2 For educational purposes only — hack ethically!
Permissions Deep Dive
Every file has three permission sets: Owner, Group, and Others. Run ls -la and you'll see
something like:
-rwxr-xr-- 1 alice hackers 4096 Mar 1 [Link]
Read left-to-right: - (file type) rwx (owner: read+write+execute) r-x (group: read+execute) r--
(others: read only)
COMMAND WHAT IT DOES
chmod 755 file rwxr-xr-x — owner all, group/others read+exec
chmod 644 file rw-r--r-- — owner read/write, others read only
chmod +x file Add execute permission for everyone
chown alice file Change file owner to alice
chown alice:devs file Change owner AND group
Getting Help
COMMAND WHAT IT DOES
man ls Read the manual page for ls (q to quit)
ls --help Quick help flag (works on most commands)
whatis netcat One-line description of a command
apropos firewall Search man pages by keyword
■ TIP: man pages are your best friend. Get comfortable using them!
Lab Exercises
■ Lab 1: Open a terminal and navigate to /var/log — list all files and note their
permissions.
■ Lab 2: Create a directory called hacker_lab in your home folder, then create 3 empty
files inside it.
■ Lab 3: Use find to locate all files owned by root with the SUID bit set: find / -perm
-4000 2>/dev/null
■ Lab 4: Read the file /etc/passwd — identify what each field means.
■ Lab 5: Change a file's permissions to 777, then explain why that is a security risk.
Linux for Hackers · Page 3 For educational purposes only — hack ethically!