Navigate the Linux terminal
Three commands form the foundation of command-line navigation: pwd tells you where you are, ls shows what is there, and cd changes your location.
The three-command loop
1
Print the working directory
pwd
This gives you an exact path, such as /home/student.
2
List directory contents
ls ls -la
The second form includes hidden entries and detailed metadata.
3
Change directory
cd /tmp cd .. cd ~
.. means the parent directory and ~ expands to the current user's home directory.
Absolute vs relative paths
An absolute path starts at the filesystem root, for example /tmp. A relative path is interpreted from your current directory, for example docs/notes.txt.
| Command | Purpose |
|---|---|
pwd | Show current location |
ls | List entries |
cd path | Move to a directory |
cd - | Return to the previous directory |
Common mistake: If a path contains spaces, quote it or escape the spaces. Do not assume every space separates a new argument.