Linux / Bash
Beginner
1 min read
Understanding the Linux Filesystem Hierarchy
Example
# Print the current working directory
pwd
# /home/alice
# List key top-level directories
ls /
# bin boot dev etc home lib media mnt opt proc root run sbin srv sys tmp usr var
# Show disk usage of top-level dirs, sorted
du -sh /* 2>/dev/null | sort -h
# Navigate using absolute path
cd /etc/nginx
# Navigate using relative path
cd ../apache2
# Go to home directory (three equivalent ways)
cd
cd ~
cd $HOME
# Go to the previous directory
cd -
# Explore /proc virtual filesystem
cat /proc/cpuinfo | head -20
cat /proc/meminfo
cat /proc/version
ls /proc/$$/ # Current shell's process info
# Show filesystem mount points
mount | column -t
lsblk # Block devices and mount points
Related Resources
Linux / Bash Reference
Complete tag & property list
Linux / Bash How-To Guides
Step-by-step practical guides
Linux / Bash Exercises
Practice what you've learned
More in Linux / Bash