File System Navigation
In Linux, everything is a file. To work effectively, you must know how to navigate the Hierarchical File System.
Important Directories
- / (Root): The starting point of the entire file system.
- ~ (Home): Your personal user directory (e.g., /home/username).
1. pwd (Print Working Directory)
Use pwd to see exactly where you are in the file system.
Bash
pwd
2. ls (List)
The ls command lists the files and folders in your current directory.
Bash
ls
Common Options:
- ls -a: Show hidden files (those starting with a dot).
- ls -l: Show detailed information (permissions, size, date).
3. cd (Change Directory)
The cd command allows you to move between folders.
Bash
# Move to a specific folder cd Documents # Move back to the parent folder cd .. # Move straight to your Home directory cd ~ # Move to the Root directory cd /
Absolute vs. Relative Paths
Absolute Path: Starts from the root / and provides the full path (e.g., /home/user/Documents).
Relative Path: Starts from your current location (e.g., if you are in /home/user, you can just type cd Documents).