HACK THE PLANET LABS 0 XP · New Recruit

Lab 03 · Beginner to Early Intermediate · 35–45 min · Linux Fundamentals

Linux Field Operations

Almost every server, every cloud machine and every security tool runs on Linux. This lab teaches you to move around it, read it, inspect it and lock it down — from the command line, the way professionals do.

Mission Brief

Your mission

Learn the Linux command line well enough to navigate a real system, inspect it, and protect a folder with the right permissions — then prove it in a simulated terminal mission.

By the end of this lab you will understand

  • What Linux is — the kernel, the shell and the terminal
  • How the filesystem is organised, and how absolute and relative paths work
  • How to move around and work with files: pwd, ls, cd, cat, touch, mkdir, cp, mv, rm
  • How to inspect a system: whoami, id, uname, ps, top
  • How permissions work — owner, group, others; read, write, execute; chmod
  • How to think in commands: command, argument, option, output

Prerequisites: Labs 01 and 02 (the labs unlock in order). What you need: this page and a browser. Everything in this lab uses a fictional training system — no real commands run anywhere, and nothing here touches your own computer.

Module 1

The Linux environment

Linux runs most of the internet’s servers, most cloud machines, and most security tools. It is free, open source, and built around the command line — which is exactly why cybersecurity professionals live in it.

YouType a command
→
TerminalThe window you type in
→
Shell (bash)Reads the command, runs it
→
KernelThe core of Linux
→
HardwareCPU, disk, memory, network

The four layers, in plain words

  • Terminal — the program that shows you a prompt and lets you type. It is only a window; it does no work itself.
  • Shell — the program inside the terminal that reads what you type and runs it. The most common shell is bash. When you type ls, it is the shell that finds and runs the ls program.
  • Kernel — the core of the operating system. It talks to the hardware, manages processes and memory, and enforces permissions. Linux is the kernel.
  • Distribution — the kernel plus the tools, programs and package manager bundled around it. Ubuntu, Debian and Fedora are general-purpose distributions; Kali Linux is the security-focused one, pre-loaded with penetration-testing tools.

When a command runs, the shell asks the kernel to do the work, the kernel talks to the hardware, and the result comes back up the chain to your screen. Every module in this lab is one part of that chain.

Why the command line? A graphical interface shows you what someone else decided you need. The command line shows you everything — every file, every process, every permission — and it can be scripted, so a task you do once can be repeated a thousand times. That is why servers usually have no desktop at all.

Module 2

Filesystem navigation

Linux has one filesystem tree, starting at the root directory /. Everything — your files, the system’s files, even devices — lives somewhere under it. Click any directory in the map below to see what it is for. This is the same fictional filesystem you will work in during the challenge.

Click a directory above

Each directory has one job. Click one to see its purpose here.

Moving around: pwd, ls, cd

Three commands cover almost all navigation:

pwd
/home/learner

ls
documents  downloads  mission

cd mission
pwd
/home/learner/mission
  • pwd — “print working directory”. Tells you where you are right now.
  • ls — lists what is inside the current directory. ls -l shows the long format: permissions, owner, size and date.
  • cd — “change directory”. cd mission moves into mission; cd .. moves up one level; cd alone takes you home; cd / takes you to the root.

Absolute vs relative paths

  • Absolute path — starts from the root: /home/learner/mission. It works from anywhere, because it spells out the whole route.
  • Relative path — starts from where you are: from /home/learner, cd mission is enough. From anywhere else, it fails — there is no mission there.
  • . means “this directory” and .. means “the parent directory”. cd ../documents goes up one level, then into documents.

Common mistake: typing cd /mission when you mean cd mission. The leading slash changes everything — it tells the shell to look at the root of the filesystem, not inside your current folder. If you get “No such file or directory”, check whether your path starts with a slash it should not have.

Module 3

File operations

Once you can move around, you can work with files. Every command below is one verb — learn the verb, and the rest is practice.

CommandWhat it doesSafe example
catPrints a file’s contents to the screen.cat notes.txt
lessOpens a file page by page, for long files.less /var/log/messages
touchCreates an empty file (or updates its timestamp).touch draft.txt
mkdirCreates a directory.mkdir vault
cpCopies a file: cp source destination.cp notes.txt notes-backup.txt
mvMoves or renames a file.mv draft.txt final.txt
rmDeletes a file. Permanent — there is no recycle bin.rm draft.txt

cat is for reading, less is for reading long files without flooding the screen (press q to quit less). cp keeps the original and makes a second copy; mv moves it, so the original location ends up empty. And mv is also how you rename things — moving a file to a new name in the same folder.

Respect rm. Deleted files do not go to a trash folder — they are gone. rm -rf deletes a folder and everything inside it without asking. Professionals check the path twice before pressing Enter, and they never run rm on a path they have not read. In this lab’s training terminal, rm is disabled on purpose — deleting is the one thing a practice environment should never let you do by accident.

Module 4

System inspection

Before you change anything on a system, you look at it. These five commands answer the first questions a professional asks: who am I, what machine is this, and what is running on it?

CommandWhat it answersExample output
whoamiWhich user am I logged in as?learner
idWhat are my user ID, group ID and groups?uid=1000(learner) gid=1000(learner) groups=1000(learner)
unameWhat system is this?Linux htp-lab 6.8.0-htp x86_64 GNU/Linux
psWhich processes are running?See below
topWhat is using CPU and memory right now?See below

Users and groups

Every user has a number (UID) and belongs to a group (GID). root is UID 0 — the administrator, who can do anything. Normal users start at UID 1000. id shows all of it at once, which is why it matters for permissions in the next module: a file’s owner and group decide who may touch it.

Processes

A process is a running program. Every process has a number (PID). ps lists the ones running now:

  PID TTY          TIME CMD
    1 ?        00:00:02 systemd
  412 ?        00:00:00 sshd
  638 pts/0    00:00:00 bash
  901 pts/0    00:00:00 ps

top shows the same picture live, sorted by CPU usage, refreshing every few seconds — press q to quit it:

top - 01:30:00 up 2 days,  1 user,  load average: 0.12, 0.08, 0.05
Tasks:  84 total,   1 running,  83 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.2 us,  0.8 sy,  0.0 ni, 98.0 id,  0.0 wa,  0.0 hi,  0.0 si
MiB Mem :   3934.2 total,   2871.5 free,    412.3 used,    650.4 buff/cache

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
  638 learner   20   0   12340   5120   3400 S   0.3   0.1   0:00.04 bash

Defender’s habit: when something feels wrong on a system, the first checks are ps and top. A process you do not recognise — a strange name, a program running from a temp folder, a process eating CPU at 3 AM — is the kind of thing that starts an investigation. Knowing what normal looks like is what makes abnormal visible.

Module 5

Linux permissions

Every file and folder has permissions: who may read it, who may write to it, and who may execute it. Permissions are the first line of defence on a Linux system — they decide what a stolen password or a compromised program can actually reach.

Owner, group, others

Permissions are set for three groups of people:

  • Owner — the user who owns the file (usually the one who created it).
  • Group — the file’s group; members of that group share the group’s permissions.
  • Others — everyone else on the system.

Read, write, execute

Each of the three groups gets three permissions, each worth a number:

PermissionValueOn a fileOn a folder
r — read4Read the file’s contentsList what is inside
w — write2Change or delete the fileCreate or delete files inside
x — execute1Run the file as a programEnter the folder (cd into it)

Add the values to get the number: read (4) + write (2) = 6; read + write + execute (4 + 2 + 1) = 7; nothing = 0. Three digits — owner, group, others — describe the whole file. That is why you see numbers like 755 and 644 everywhere.

Try it: the permission calculator

Toggle the permissions below and watch the symbolic and numeric forms change together.

Owner
Group
Others
rw-r--r--
644

Owner can read and write; group can read; others can read.

Common setups

ModeSymbolicUse it for
755rwxr-xr-xFolders and public programs — everyone can enter and read, only the owner can change.
644rw-r--r--Ordinary files — everyone can read, only the owner can change.
700rwx------Private folders — only the owner can enter. Your .ssh folder uses this.
600rw-------Private files — only the owner can read or write. SSH private keys use this.

To change permissions you use chmod — chmod 700 vault sets a folder to owner-only, chmod 644 notes.txt makes a file readable by everyone but changeable only by you. You will use exactly this in the challenge.

The 777 trap. When something does not work, the lazy fix is chmod 777 — everyone can do everything, so the error goes away. So does your security: any user, any program, any attacker who gets in can now read, change and delete that file. A permission error is the system doing its job. Fix the permission, not the warning.

Module 6

Command-line thinking

Every command has the same shape. Learn the shape once, and every new command you meet will look familiar. Click each part:

ls -l /home/learner

Click a part above

Command, option, argument — and the output that comes back. Click one to see what it does.

Putting commands together

Real work is a sequence of small commands, each doing one thing. The mission in this lab is exactly that — a recipe of five steps:

pwd
cd mission
ls
cat flag.txt
mkdir vault
chmod 700 vault
ls -l

Each line is one command, and each one only makes sense after the one before it: you check where you are, move to the right folder, look inside it, read the file, create the folder, lock it down, and verify the result. That is command-line thinking — not memorising commands, but chaining small, exact steps into a job done properly.

On a real system you can also chain commands with && — mkdir vault && chmod 700 vault runs the second command only if the first one succeeds. The training terminal runs one command at a time, so practise the steps separately here; the habit of checking each step before the next is the skill that transfers.

Knowledge Check

Check what you learned

Six questions. You need 4 out of 6 to pass and earn 30 XP. Every answer explains itself — right or wrong.

Practical Challenge

Mission: the simulated terminal

You are logged in to a fictional training system as user learner, starting in /home/learner. This is a real working terminal simulation — it keeps state: directories you create stay created, permissions you change stay changed. Nothing here runs on a real system, and only the commands in help are allowed. Complete all seven objectives:

  1. 1 · Find out where you are — run pwd.Todo
  2. 2 · Navigate to /home/learner/mission.Todo
  3. 3 · Find the training file — list the mission folder and spot flag.txt.Todo
  4. 4 · Read the file — cat flag.txt and read the code inside.Todo
  5. 5 · Create a directory called vault inside the mission folder.Todo
  6. 6 · Lock it down — chmod 700 vault.Todo
  7. 7 · Verify — run ls -l and confirm vault shows drwx------.Todo

0 of 7 complete. Type help in the terminal if you are unsure where to start.

learner@htp-lab — training terminal (simulated)
learner@htp-lab:~$

Your progress in the terminal is checked live during this visit. Your overall lab completion is saved on your device. Resetting the terminal restores the fictional filesystem and clears your mission progress — use it if you get stuck.

Debrief

What you learned — and what comes next

The mission, solved step by step:

pwd
/home/learner

cd mission
ls
flag.txt  notes.txt

cat flag.txt
HTP-LAB3-FLAG-7K2Q9

mkdir vault
chmod 700 vault
ls -l
drwx------ 2 learner learner 4096 Nov 21 01:30 vault
-rw-r--r-- 1 learner learner   84 Nov 21 01:30 flag.txt
-rw-r--r-- 1 learner learner   96 Nov 21 01:30 notes.txt

Common mistakes

  • cd /mission instead of cd mission — the leading slash sends you to the root, where no mission folder exists. Relative paths start from where you are.
  • Trying cat flag.txt from the wrong folder — the file lives in mission. If cat says “No such file”, check pwd first.
  • chmod before mkdir — you cannot change the permissions of a folder that does not exist yet. Create first, protect second.
  • Forgetting to verify — running chmod and assuming it worked is not a check. ls -l showing drwx------ is the proof.

Security relevance

Permissions are the cheapest defence in computing. A private key at 600 cannot be read by another user even if they get onto the same machine; an .ssh folder at 700 cannot be entered at all. The vault you just built is the same idea: the owner has full access, everyone else has nothing. Attackers love misconfigured permissions — world-writable folders, private keys left at 644, web roots at 777 — because the system itself hands them the keys.

Defensive guidance

  • Apply the least privilege: give the smallest permission that still lets the job get done.
  • Check before you change: ls -l first, chmod second, ls -l again to verify.
  • Never use 777 to “fix” a permission error — find out who actually needs access and grant exactly that.
  • Audit regularly: unknown files in /tmp, strange processes in ps, and world-writable files are the first things a defender looks for.

Skills acquired

Terminal and shell basics · Filesystem navigation and paths · File operations · System inspection (whoami, id, uname, ps, top) · Permission model and chmod · Verifying your own work before calling it done.

Complete the quiz and the challenge to finish this lab.

Completing this lab earns the “Terminal Operator” achievement — and if you have finished all three labs, “Field Ready” too. Your recommended next step is the Ethical Hacking: From Basics to Advanced course on the main site, which builds directly on everything these three labs taught. This preview only demonstrates the recommendation — course access itself is unchanged: hackthepalnte.co.uk/resources.