This is the first in an irregular series of short posts that teach some Linux command line basics that you might not know or may have forgotten.
Let's kick off this series with a quick look how to move around the command line using the cd command.
The cd command enables you to move between directories. So let's image you're at the top level of your /home directory — for example, /home/scott — and you want to move to a directory named Photos. To do that, type:
You can also use cd to move into and around subfolders. Say you're in your home directory, and you want to go to the folder Documents/Letters. To do that, type:
If, on the other hand, you want to move to a directory that's outside of /home, type cd and the full path to the directory. For example, to jump to a common directory for executable files on your system, type:
You can also use the cd command to up and down inside a folder and its subfolders. If you're in the directory Photos/Family, but decide that you want to move one level up to the directory Photos/Taupo2021, type:
The ../ tells the cd command to move up one level and then change to the directory that you specify.
You can use ../ as many times as you need. So, if you want to move from Photos/Taupo2021 to the folder Documents/Letters, type:
The ../../ moves you up two levels in the directory structure and the cd command puts you in the directory in which you want to go.
— Scott Nesbitt