Where am I? Absolute and relative paths
The treasure is not in your home folder. Follow the chain of clues: each one tells you where to find the next, sometimes with a relative path, sometimes with an absolute one. Learn to always know where you are.
Lab 2 of 9 in the Linux Fundamentals path. If you get stuck you have 3 hints, from the vaguest to the most precise: they cost 0, 40 and 120 XP.
What you learn
Objectives complete themselves while you work in the terminal; each one is worth experience points:
- Follow a relative path (mappe/vecchie) (50 XP)
- Move to a sibling folder with .. (50 XP)
- Leave your home with an absolute path (60 XP)
- Open the right drawer in the archive (60 XP)
Topics: linux, percorsi.
Commands you will use
The terminal is simulated and understands about forty Linux commands. In this lab you will mostly need these:
cat: prints the contents of a file: the most direct way to read configurations, notes and logs.cd: changes folder, with an absolute path (starting from /) or a relative one (with . and ..).ls: lists the files in a folder; with -l it shows permissions and owners, with -a hidden files too. It is the first command on any machine.pwd: tells you which folder you are in: the starting point of every relative path.
The simulated environment
You work in a simulated Linux shell, in the home folder of the user runner: invented files and folders, no network target.
Besides the home folder there is a complete simulated system, with configuration files, logs, users and permissions to examine.
The defensive lesson
Once the lab is solved, the write-up explains what went wrong and how to protect yourself:
An absolute path starts from the root (/) and works from anywhere; a relative one starts from the current folder and uses . and ..: pwd always tells you your starting point. Knowing where you are avoids costly mistakes (deleting or copying in the wrong folder). For defenders, knowing the filesystem map (/srv, /var, /opt) means knowing where the important data lives, and therefore who can reach it.
Before and after this lab
To unlock it you must have solved:
- First steps in the shell (Linux Fundamentals, easy)
After this lab you can move on to:
- Hidden files (Linux Fundamentals, easy)
The Linux Fundamentals path
Linux Fundamentals is the starting point. Almost every server, network device and security tool runs on Linux, and anyone who defends a system (or tests it with permission) spends much of their time in a terminal. Here you learn to move around the filesystem, find hidden files, read huge logs piece by piece, search for words with grep, chain commands with pipes and understand permissions, environment variables and history: the basics you will use in every other path.