Useful terminal commands

In this lesson we will cover some of the basic commands in the terminal. We will learn how to list the content of a directory, create and manipulate files, print a line of text, change the working directory, etc.

ls command

One of the most commonly used commands it the ls command. This command lists the content of the specified directory. If no directory is specified, the ls command displays the content of the working directory:

raspberry ls command

To get a more detailed output, we can use the ls -l command:

raspberry ls l command

pwd command

The pwd command is used to print the path of the current working directory (the directory we are currently in):

raspberry pwd command

cd command

The cd command is used to change the working directory. The path of the directory you would like to access needs to be specified in the command. For example, to change the working directory to /opt, the cd /opt command is used:

raspberry cd command

Note how the prompt changed to reflect the change.

echo command

The echo command is used to output text to the screen. The text that will be displayed is entered after the echo keyword:

raspberry echo command

whoami command

To display the current user, the whoami command is used:

raspberry whoami command

Geek University 2021