Linux Terminal FundamentalsLesson 2.1
How to navigate the Linux filesystem with cd, ls, and pwd
pwd command, cd absolute vs relative paths, ls flags, home directory tilde shortcut, hidden files, filesystem hierarchy
Navigating the Linux Filesystem
Every command you run in the terminal happens inside a directory. These three commands tell you where you are and let you move around.
pwd โ print working directory
pwd
# /home/yournamepwd prints your current location. Run it whenever you feel lost.
ls โ list directory contents
ls # basic list
ls -l # long format: permissions, size, date
ls -la # includes hidden files (names starting with .)
ls -lh # human-readable sizes (KB, MB)Files beginning with . are hidden by default. Your shell config (.bashrc, .zshrc) and SSH keys (.ssh/) live here.
cd โ change directory
cd /etc # absolute path
cd Documents # relative path
cd .. # go up one level
cd ~ # go to home directory
cd - # go back to previous directoryAbsolute paths start with /. Relative paths do not. ~ always expands to your home directory.
Practical flow
pwd
ls -la
cd ~/projects
lsTab completion works in every directory: type the first few letters of a name and press Tab. Double-Tab lists all matches.
