How to navigate the Linux file system
· Category: Linux
Short answer
Use cd, ls, and pwd to navigate directories, list contents, and see your current location in the Linux file system.
Steps
- See your current directory:
pwd
- List files:
ls -la
- Change directory:
cd /var/log
- Go back one level:
cd ..
- Go to home:
cd ~
Tips
ls -lhshows human-readable file sizes.- Use tab completion to save time and avoid typos.
- The root directory
/is the top of the Linux file system.
Common issues
- Permission denied: you lack read access to the directory.
- Spaces in names: quote the path or escape spaces with backslash.