Basic Linux concepts

The terminal is a way to interact with your computer using only a text interface. You are likely used to seeing a graphical interface where you can click a mouse to navigate files and folders, start programs, anything else you do with your computer. When using the terminal, you instead type commands at a prompt, and the results of those are printed in text (see the example below). Some basic commands can be found in this section, but first let’s work out on some concepts.

A screenshot of a terminal and prompt on Windows. Other terminals might not look exactly the same, but they behave similarly.

Prompt: Is the line where commands are going to be written. Usually you can find in this line the username followed by the "$" sign and possibly a blinking cursor (see example above).

Now that you know your terminal we need to be able to use commands to navigate! And like in any journey, we need to know where we are and where we want to go. Your files and folders are organized in a hierarchical way. So any location within the hierarchy is represented by a line of text containing the parent folders separated by slashes (see example below). This is called a path which can lead to a folder, to a file, to a program, etc.

Path: It is the representation of any folder location within the hierarchical tree in text form. It is what tells you the location of a Content (file, folder, etc). Below you can see both representations of a path to the folder where I have pictures of my 1st visit to Belgium. In the terminal we always use the text form of a path, and each folder is separated by a / until the last item in your path that can be anything including a file! Imagine it like the list of roads you need to turn until you find the final address of a house.

Once you open your terminal you will find yourself in your home directory (~ is short for “home directory”). Usually, you can see part of your path in the prompt, but what if you want the complete path? You need to ask in your terminal where you are now! For that you use the command pwd (print working directory) by typing the command in the prompt and pressing <ENTER>. The output is the absolute path to your current working directory followed by a new prompt.

As we said shortly before, the folders in a path are separated by /. This is the separator of content, in the example below the folder c contains the folder Users . That folder contains the folder pier. Each folder can contain more sub-folders, but a path can only show the location of a single file or folder. Below, you can see the combination of the hierarchical tree and the path to one of the folders.

/C/Users/pier

1 – Click to do exercise in a controlled environment before practicing quiz:
LinuxSurvival (print working directory)

2 – Practicing a bit more in replit:
Open the terminal in replit, and find out what the path of your current directory is.
Take note of it, that is your starting point. In the next sessions I’ll tell you how to list what you have in the directory and how to navigate in and out other directories.