Start free →
Cybersecurity · Lesson 4
0 XP
Lesson 4 of 2020 minHands-on

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.

Your teacher says

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?

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.

CommandMeansThink of it as
pwdprint working directory"Where am I right now?"
lslist"What's in this folder?"
ls -lalist all, with details"Show me everything, even hidden files"
cd noteschange directory"Walk into the notes folder"
cd ..go up one level"Step back out"
cat file.txtshow a file"Read this to me"
mkdir labmake directory"Create a new folder"
touch a.txtcreate an empty file"Make a blank page"
whoamiwho am I"Which user am I?"
clearclear 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.

practice terminal · safe

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.

Quick check+10 XP

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.

Test · Q1+10 XP

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.

Test · Q2+10 XP

Which part of a computer is wiped when you switch it off?

RAM is temporary. Storage keeps data without power.

Test · Q3+10 XP

What does a website see when you visit it from home Wi-Fi?

Websites see the public "building address" of your router.

Test · Q4+10 XP

Port 443 is usually used for…

443 = HTTPS. 80 is HTTP, 22 is SSH, 53 is DNS.

Test · Q5+10 XP

Which Linux command shows hidden files too?

ls -la lists all files, including ones starting with a dot.

Test · Q6+10 XP

"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 →