Module 2 ยท Lesson 2 ยท 30 minutes

โŒจ๏ธ Terminal is Not Scary

10 commands you'll use every day. By the end of the lesson, you'll be navigating Kali without a mouse.

๐Ÿ“– Story Hook

When I first saw a Linux terminal, I thought, "this is what hackers in movies use." A black screen, white text, nothing makes sense.

Now, I open the terminal 200 times a day. And every time, it's more convenient than using a mouse. Seriously.

The terminal is a direct conversation with your computer. No need to click "Open โ†’ Folder โ†’ Documents โ†’ New Folder". One command, and you're done.

In this lesson, we'll learn 10 commands. After that, the terminal will become your best friend.

๐ŸŽฏ Command #1: pwd โ€” "where am I"

Open the terminal. Type:

pwd

Response:

/home/kali

pwd = "Print Working Directory". Shows your current folder.

This is your home folder. Similar to "C:\Users\Your Name" in Windows.

๐ŸŽฏ Command #2: ls โ€” "what's around me"

ls

Will show you the files and folders in your current directory:

Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos

Options (always after the command, separated by a space):

ls -l       # detailed (size, date, permissions)
ls -a       # including hidden files (starting with .)
ls -la      # both at once
ls -lh      # size in human-readable format (KB / MB / GB)

Try: ls -la. You'll see many more files.

๐ŸŽฏ Command #3: cd โ€” "move to another folder"

cd Documents

You've entered the Documents folder. Check:

pwd
# /home/kali/Documents

Special symbols:

cd ..       # one level up (parent folder)
cd ~        # home (=/home/kali)
cd /        # system root
cd -        # previous folder (like Back)

๐Ÿ’ก Tab Life Hack: start typing a folder name โ†’ press Tab โ†’ the terminal will auto-complete. This will save you hours over your career.

๐ŸŽฏ Command #4: cat โ€” "show file contents"

cat /etc/hostname

Will show you "kali" (your computer's name).

cat /etc/os-release

Will show you system info (Kali version, ID, etc.).

For long files:

less /etc/passwd     # scroll with arrows, exit with q
head -10 file.txt    # first 10 lines
tail -10 file.txt    # last 10 lines
tail -f /var/log/auth.log  # follow changes in real-time

๐ŸŽฏ Command #5: grep โ€” "find text in a file"

This is a super-important command for hackers. Searches for lines containing specific text.

grep "kali" /etc/passwd

Will show you lines in /etc/passwd containing "kali".

Useful options:

grep -i "PASSWORD" config.txt    # case-insensitive
grep -r "secret" /var/www/        # recursive search
grep -n "error" log.txt           # with line numbers
grep -v "INFO" log.txt            # exclude matches

Real-life example: you've hacked a site, downloaded base.tar.gz, and need to find the database password:

grep -ri "DB_PASSWORD\|db_pass\|database.*password" extracted_files/

๐ŸŽฏ Command #6: find โ€” "find files"

find / -name "passwd" 2>/dev/null

Will find all files named "passwd" on the entire system. 2>/dev/null ignores access errors.

Useful patterns:

find . -name "*.conf"              # all .conf files in the current and subfolders
find /home -type f -size +10M      # files larger than 10MB in /home
find / -perm -4000 2>/dev/null     # all SUID files (important for privilege escalation!)
find / -mtime -1                   # files modified in the last 24 hours

๐ŸŽฏ Command #7: mkdir / rm / mv / cp

mkdir test_folder           # create a folder
mkdir -p path/to/deep/dir   # create nested folders

cp file.txt backup.txt      # copy a file
cp -r folder1 folder2       # copy a folder recursively

mv old.txt new.txt          # rename (or move)
mv file.txt /tmp/           # move to /tmp

rm file.txt                 # delete a file
rm -rf folder/              # delete a folder with all contents (BE CAREFUL!)

โš ๏ธ rm -rf / will delete EVERYTHING. Never run this command. And don't trust code from unverified sources that contains it.

๐ŸŽฏ Command #8: chmod โ€” "change permissions"

More details in Lesson 2.3, but the basics:

chmod +x script.sh    # make executable
chmod 755 file        # rwx for owner, r-x for others
chmod 644 config.txt  # rw for owner, r for others

๐ŸŽฏ Command #9: pipes (|) and redirects (>, >>)

This is Unix magic. Connects multiple commands:

# Pipe (|): output of one command โ†’ input of another
ls -la | grep "kali"          # ls + search for lines with "kali"
cat log.txt | grep "ERROR" | head -10   # last 10 errors

# Redirect (>): save output to a file
ls -la > files.txt            # overwrite
ls -la >> files.txt           # append

# Stderr (2>): redirect errors
find / -name "secret" 2>/dev/null   # ignore access errors

Real-life example: find all .php files containing "mysql_query":

find /var/www -name "*.php" | xargs grep -l "mysql_query" 2>/dev/null

๐ŸŽฏ Command #10: sudo โ€” "run as admin"

sudo apt update         # update package list
sudo apt install nmap   # install nmap
sudo -i                 # become root (exit with exit)

sudo = "Super User DO". Asks for your password (your regular one, for kali). After entering the password, the command runs with root privileges.

๐Ÿ’ก Life Hack: sudo remembers your password for ~15 minutes. Enter it once, and subsequent sudo commands will run without asking for a password.

๐Ÿ† Final Exercise

Run the following commands in the terminal, in order:

  1. cd ~ โ€” go home
  2. mkdir hacking_practice โ€” create a folder
  3. cd hacking_practice โ€” enter the folder
  4. echo "Hello hacker world" > greet.txt โ€” create a file
  5. cat greet.txt โ€” check the contents
  6. ls -la โ€” see what's in the folder
  7. grep "hacker" greet.txt โ€” find the word
  8. cp greet.txt greet_backup.txt โ€” make a copy
  9. ls โ€” two files should be there
  10. rm greet_backup.txt โ€” delete the copy
  11. cd .. โ€” exit the folder

If all 11 commands succeed โ€” you've mastered the basics of the terminal. This is enough for 95% of a penetration tester's work.

๐Ÿค– Vibe-task: ask Claude

Open Claude and ask:

I've just learned 10 basic Linux commands:
pwd, ls, cd, cat, grep, find, mkdir/rm/mv/cp, chmod, pipes, sudo.

Give me 5 practical tasks with a difficulty level from easy to medium
that I can complete right now in my Kali Linux to reinforce my skills.
Each task โ€” 1 sentence with what to do + expected result.

Complete these 5 tasks. If you get stuck โ€” ask Claude again.

๐Ÿ’ก Cheat Sheet (print it)

CommandWhat it doesExample
pwdShows current folderpwd
lsShows files and foldersls -la
cdChanges foldercd Documents
catShows file contentscat file.txt
grepFinds text in a filegrep "error" log
findFinds filesfind / -name "*.conf"
mkdirCreates a foldermkdir test
cp / mv / rmCopies / moves / deletescp a b
chmodChanges permissionschmod +x script
|Pipes outputls | grep "txt"
sudoRuns as adminsudo apt update

๐ŸŽฌ What's Next

In Lesson 2.3, we'll cover permissions and root. What "root" means, where passwords are stored in Linux, and what chmod 755 exactly means. This is the foundation for Module 5, "Web Vulnerabilities", where we need to understand how servers store data.

โ† Lesson 2.1 Lesson 2.3: Permissions โ†’