Lesson 6: Moving around the filesystem¶
To change directories in Linux, we use the cd command. For example:
[learner ~]$ cd learning_linux/
[learner learning_linux]$
Note
The command prompt has now changed to indicate the current working directory.
When navigating the Linux filesystem, you can change directories using either an absolute or relative path.
Absolute Paths¶
An absolute path lists the target directory and all parent directories up to and including the root directory, for example:
[learner ~]$ cd /home/$APOC_USERNAME/learning_linux
[learner learning_linux]$
You must type the above exactly as it is printed because APOC_USERNAME
is a custom Linux variable we have used to reference your username.
Relative Paths¶
A relative path describes the filesystem navigation in relation to the current working directory (not from the root directory), for example:
[learner learning_linux]$ cd ../directory1
[learner directory1]$
Let's navigate back to the previous directory, learning_linux
. You
can either enter the absolute path, the relative path or cd -
to
navigate back to the previous directory.