Script Valley
Linux & Bash for Developers
Linux Fundamentals & File SystemLesson 1.3

How to navigate directories in Linux terminal

cd, pwd, ls flags, pushd popd, tab completion, directory shortcuts, hidden files

Moving Around the File System

Three commands cover 90% of navigation: pwd (where am I), ls (what is here), and cd (go somewhere). Master their flags and you move faster than any GUI file manager.

ls Flags That Matter

ls -l shows permissions, owner, size, and modification date. ls -a reveals hidden files (prefixed with a dot). ls -lh makes file sizes human-readable. Combine them: ls -lah.

# See everything including hidden files with details
ls -lah

# Navigate to home, then back to previous directory
cd ~
cd -

# Push current directory onto a stack, go to /etc
pushd /etc
# Return to original directory and pop stack
popd

# Tab completion — type partial name and press Tab
cd /usr/lo[TAB]  # autocompletes to /usr/local

Hidden Files and Dotfiles

Files starting with a dot are hidden from ls by default. Your shell config (~/.bashrc), SSH keys (~/.ssh/), and git config (~/.gitconfig) are all dotfiles. Always use ls -a when troubleshooting configuration issues — the file you are looking for may be hidden.

Up next

Creating, copying, moving, and deleting files in Linux

Sign in to track progress