Chapter 2: Basic Commands

Foreword

We recommend that you do not use AI to do the exercises, as you are still in the learning phase.

Introduction

Although there are a multitude of commands in Linux, a few are essential for getting the most out of this system. You will likely use them every day.

Prerequisites

Info:
If you don’t have a Linux environment available, you can register at https://killercoda.com and go to https://killercoda.com/playgrounds/scenario/ubuntu to access a virtual machine running Ubuntu 24.04 (without a graphical interface, of course!) for 1 hour, renewable for free. You will then see this view: !

Bonus for the Killerkoda team 👨🏾‍💻👩🏾‍💻:



Discovering the Linux terminal

When we talk about the Linux terminal, we mainly mean the command prompt and command interpreter (shell). But also commands. Example of a Linux terminal:

  1. The command prompt
    • This is the line that indicates where you are and who you are in the system. It can vary depending on the distribution and configuration, but it often looks like this:
      Example: user@machine:directory$
    • user: Your username.

The Linux system tree

The Linux system tree is like a large, well-organized cabinet with lots of drawers and folders. This is how files and directories are structured in a Linux system. Everything starts from a single point called the root, denoted simply by a slash “ / ”. From there, everything is organized into branches, like a tree (hence the name “tree structure”). Here are the main directories and their roles:

Below is a small illustration:

To test 👨🏾‍💻👩🏾‍💻:

Additional info:

The “/etc” directory mainly contains configurations related to your entire Linux system, but there is also a configuration directory called “.config”, which is usually located in each user’s home directory ( /home/username ). This is a hidden directory containing specific configurations for applications depending on each user.

Comparison between the Linux and Windows directory trees (BONUS)

Let’s compare the Linux directory tree with that of Windows, as if we were comparing two cabinets with different storage logics.

Linux: The unified directory tree (everything starts from /)

In Linux, everything starts at the root (/) and is organized into a single large structure. Each directory has a well-defined function:

The big differences

  1. Single root vs. multiple letters:
    • Linux: Everything is connected to /.
    • Windows: Each drive is a separate island (C:, D:, etc.).
  2. Clear roles vs. mixing:
    • Linux keeps things separate (configs in /etc, programs in /bin).
    • Windows often puts everything in C:\Windows or C:\Program Files, which can seem less structured.
  3. Paths:
    • Linux: /home/user/doc.txt.

Basic commands

Info: If you are used to using your graphical interface to work, your goal will be to reproduce everything you know how to do in the graphical interface in the Linux terminal (create/move/copy/delete files/folders, create shortcuts, move around directories/folders, etc.).

# Navigation and file management commands

System information commands

Try it out 👨🏾‍💻👩🏾‍💻:

man find


# Training ⚔️
## Exercise 1
* Complete at least the first 10 challenges: https://cmdchallenge.com/

## Exercise 2
The exercises in this section will be in the form of challenges. There will be five challenges. Each challenge is accessible via a script that you will need to run to get started.
* Link to the challenge 1 script: https://raw.githubusercontent.com/N0vachr0n0/NoFD/refs/heads/main/BC_EXO_1.sh
* Link to the script for challenge 2: https://raw.githubusercontent.com/N0vachr0n0/NoFD/refs/heads/main/BC_EXO_2.sh
* Link to the script for challenge 3: https://raw.githubusercontent.com/N0vachr0n0/NoFD/refs/heads/main/BC_EXO_3.sh
* Link to the script for challenge 4: https://raw.githubusercontent.com/N0vachr0n0/NoFD/refs/heads/main/BC_EXO_4.sh
* Link to the script for challenge 5: https://raw.githubusercontent.com/N0vachr0n0/NoFD/refs/heads/main/BC_EXO_5.sh

Below is an example of execution:
```bash
# Download the challenge 1 script
curl -LO https://raw.githubusercontent.com/N0vachr0n0/NoFD/refs/heads/main/BC_EXO_1.sh
# Make it executable
chmod +x BC_EXO_1.sh
# Run it to start the challenge
./BC_EXO_1.sh

Exercise 3 (Deep dive)

Exercise 4 (Bonus)

To learn how to master/familiarize yourself with the vim text editor, we recommend using vimtutor. Open your terminal and type vimtutor. You will get a response similar to: — —

Feedback

Please give us your feedback about this chapter.

👉🏾 Click here