LinuxTutorial2 min read

How to Navigate the Linux File System

Learn to move around the Linux file system confidently using ls, cd, pwd, and tree — the four commands every Linux user needs from day one.

Developer terminal on a laptop in low light

Understanding the Linux Directory Tree

Linux organises everything in a single tree that starts at / (the root). Unlike Windows, there are no drive letters — every disk, USB drive, and network share is mounted somewhere inside this tree. Knowing how to move around it is the first skill to master.

pwd — Where Am I?

pwd (print working directory) prints your current location:

pwd
# /home/alice

Run it whenever you feel lost.

ls — List What's Here

The ls command lists the contents of a directory. The most useful flags:

  • ls -l — long format showing permissions, owner, size, and date
  • ls -a — show hidden files (names starting with .)
  • ls -lh — long format with human-readable file sizes (KB, MB)
  • ls -lt — sort by modification time, newest first
ls -lah /etc

cd — Change Directory

Use cd to move between directories:

cd /var/log          # go to an absolute path
cd Documents         # go to a relative path
cd ..                # go up one level
cd ~                 # go to your home directory
cd -                 # go back to the previous directory

The tilde ~ is shorthand for your home directory (/home/yourusername).

tree — Visual Directory Structure

tree prints a directory and all its contents as a visual hierarchy. Install it if it's missing:

sudo apt install tree   # Debian/Ubuntu
tree ~/projects
# projects
# ├── my-app
# │   ├── index.js
# │   └── package.json
# └── scripts
#     └── deploy.sh

Limit depth with tree -L 2 to avoid overwhelming output on large directories.

Key Linux Directories to Know

  • /home — user home directories
  • /etc — system configuration files
  • /var/log — log files
  • /tmp — temporary files (cleared on reboot)
  • /usr/bin — most user-facing programs
  • /root — home directory of the root (admin) user

Tab Completion Saves Time

Press Tab after typing part of a path to auto-complete it. Press Tab twice to see all possible completions. This is one of the biggest productivity wins on the command line.