File and Directory Navigation

Essential commands for navigating the Linux filesystem.

Basic Navigation

Command

Description

Examples

pwd

Print current working directory

pwd/home/username

ls

List directory contents

ls
ls -lh (human-readable sizes)
ls /path/to/dir

cd <dir>

Change directory

cd /home
cd .. (parent)
cd ~ (home)
cd - (previous)

Common Patterns

pwd                    # Where am I?
ls -lh                 # What's here? (long, human-readable)
cd /path/to/dir        # Go somewhere
cd ..                  # Go up one level
cd ~                   # Go home
ls -la                 # List all (including hidden files)

Tips

  • Use Tab to auto-complete file and directory names

  • Press Tab twice to see all available options

  • cd without arguments takes you to your home directory

  • cd - switches to the previous directory you were in