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

  1. See your current directory:
pwd
  1. List files:
ls -la
  1. Change directory:
cd /var/log
  1. Go back one level:
cd ..
  1. Go to home:
cd ~

Tips

  • ls -lh shows 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.