Linux filesystem arborescence 🌳

Let me tell you a bit about the way linux filesystems are organized.

/ is where everything starts, it’s the root of your filesystem, a little bit like C: is usually where everything is stored on a Windows machine.

/home (which is located inside /, that’s why it starts with the same character) is where the user’s directories are usually stored. It is analogous to the C:\Users directory on Windows.

Each user has its own home 🏠 directory, you can see which one is yours using the following command :

$> echo $HOME

In a Linux terminal, the $ character designates a variable. The $HOME variable has been predefined in your terminal by the operating system, such a variable is named an environment variable.

Observe the difference between your terminal’s output when you type :

$> echo $HOME


$> echo HOME

Note : $HOME can also be replaced with the ~ character.

Manual pages 📚

Did you know that Linux comes with manuals for almost every command installed?

For instance, man ls will display the manual pages for the command ls.

You can use your keyboard’s arrows to navigate inside the manpages, the space key to skip to the next page and q to quit.

Note : It’s also time to let you know that you can access those classes directly in the terminal using the classes command! Select a class with your keyboard keys and press enter to open a course’s contents. You can navigate through the files exactly like you would with a manual page.

Stopping a command 🛑

Let’s say you use the sleep command and type something like sleep 42.

Your shell is going to wait 42 seconds before allowing you to type new commands, until then, you’re stuck!

If at some point you get stuck in a command-line which blocks the execution of new commands, you can use the CTRL + C shortcut to force the current program to quit.

Exiting a program in such a way is called killing a program.

Echo 🔉

Echo (which for some unknown reason always reminds me of Ecco the Dolphin) is an incredibly useful Linux command!

You can use it to display character strings on your screen.

For instance if you want to print “Hello, world”, you can type :

$> echo Hello, world

You can also use it to display a variable’s value, for instance :

$> echo Hello, $USER

Hands-on 🤜!

Why don’t we challenge your new command-line knowledge?

Let’s start with a little treasure hunt.

Challenge 2

Enter the challenge_2 directory.

This directory contains the flag, but where is it?! You’ll need to cleverly navigate through multiple directories in order to fetch this challenge’s flag.

Hint : You can go through multiple directories at once, instead of writing cd /gu3st and cd challenges you can directly type cd /gu3st/challenges.

Challenge 3

Hint : Don’t forget to type cd when you’re done with an exercice to go back to your home directory.

This fourth (counting the challenge 0) flag is not hidden in a file, it is stored in an environment variable!

The name of the variable is FLAG3.

Good luck!

Hint : If you need to find a command quickly you can read the cheatsheet associated with this class.

Wow, you’re still there?

Congrats on making though those first challenges!

You can now move on to

Command line 103