Your first Linux commands.
Most servers in the world, and almost every hacking and defence tool, run on Linux. And on Linux, professionals don't click around: they type commands. Today you'll type your first ones, right here on this page.
The black screen looks scary in films. It isn't. It's just a way of talking to the computer by typing instead of tapping. You'll learn 10 words today, and you'll already be ahead of most students.
Why Linux?
- Most websites, banks' servers and cloud computers run on Linux.
- Android itself is built on Linux.
- Security tools like Nmap, Wireshark and the whole Kali Linux toolkit are made for it.
- SOC analysts read Linux logs every day. Interviewers often ask basic Linux questions.
The command line, in one minute
The window where you type is called the terminal. The line waiting for you is the prompt, like ali@hyd:~$. It tells you who you are (ali), which computer (hyd), and where you are (~ means your home folder).
Folders on Linux are arranged like a tree. The very top is / (called "root"). Your home folder is usually /home/yourname.
| Command | Means | Think of it as |
|---|---|---|
pwd | print working directory | "Where am I right now?" |
ls | list | "What's in this folder?" |
ls -la | list all, with details | "Show me everything, even hidden files" |
cd notes | change directory | "Walk into the notes folder" |
cd .. | go up one level | "Step back out" |
cat file.txt | show a file | "Read this to me" |
mkdir lab | make directory | "Create a new folder" |
touch a.txt | create an empty file | "Make a blank page" |
whoami | who am I | "Which user am I?" |
clear | clear the screen | "Clean the board" |
Practice terminal
This is a safe practice terminal running inside this page (it can't harm anything). Complete the missions below by typing commands and pressing Enter. Type help if you get stuck.
- Find out where you are (
pwd) - List what's in your home folder
- Find the hidden file (hint: hidden files start with a dot)
- Go into the
notesfolder - Read
secret.txtinside notes - Go back up and create a folder called
lab
Reading permissions like a pro
When you ran ls -la you saw strange text like -rw-r--r--. These are permissions: who may read, write (change) and execute (run) a file. They come in three groups: the owner, the owner's group, and everyone else.
-rw-r--r-- owner can read+write, group can read, others can read
-rwx------ only the owner can read, write and run it
-rwxrwxrwx EVERYONE can do everything ← a security problem
A file full of passwords with rwxrwxrwx is like leaving the almirah keys in the lock. Finding badly-set permissions is a real part of security audits.
And when someone needs admin power for one command, they type sudo before it ("superuser do"). Linux then asks for the password. Remember the principle of least privilege from Lesson 2: use sudo only when you really need it.
You find a file called salaries.csv on a server with permissions -rw-rw-rw-. What's the problem?
Right. The last three letters rw- are for "everyone else". So anyone can read it (confidentiality broken) and change it (integrity broken). It should be something like -rw-------.
Try real Linux for free (optional, 20 min)
On a Windows laptop: open PowerShell as administrator and type wsl --install, restart, and you'll have Ubuntu Linux inside Windows, free from Microsoft. On Android: install Termux from F-Droid (the official source recommended by the Termux team). Then try every command from today's lesson on a real system.
Module 1 test
You've finished Module 1. Answer these to check you really understood the foundations. Take your time.
Someone edits the delivery address on your Flipkart order without permission. Which part of the CIA triad was attacked?
Integrity: data was changed without permission.
Which part of a computer is wiped when you switch it off?
RAM is temporary. Storage keeps data without power.
What does a website see when you visit it from home Wi-Fi?
Websites see the public "building address" of your router.
Port 443 is usually used for…
443 = HTTPS. 80 is HTTP, 22 is SSH, 53 is DNS.
Which Linux command shows hidden files too?
ls -la lists all files, including ones starting with a dot.
"Give every user only the access they need, nothing more." This is called…
Least privilege. Privilege escalation is what attackers try to do; responsible disclosure is reporting a bug properly.
Module 1 complete!
You understand the foundations: the CIA triad, how computers and networks work, and the Linux command line. Now let's see how attacks really work.
Next: The attacker's mindset →