
If you’re coming from Windows, you’re used to drives having letters (C:, D:). In Linux, there are no drive letters. Instead, there is a single, unified filesystem tree that starts from the root directory, denoted by a single forward slash /.
All other directories branch off from this root.
Physical storage devices (hard drives, USBs, CDs) are then “mounted” (attached) to specific directories within this tree. This might seem strange at first, but it’s a powerful and flexible system.
The structure of this tree is largely defined by the Filesystem Hierarchy Standard (FHS), which ensures that everyone knows where to find things.
Root Directory (/)
◦ The root directory (/) is the beginning of the entire Linux file system structure and forms the base of its hierarchical tree
/home Directory
◦ The /home directory is designated to contain users’ home directories.
◦ When a user logs in, their current working directory is typically their home directory, which is usually named after their login name (e.g., /home/techonquer for user techonquer).
/etc Directory
◦ The /etc directory is critical as it holds all system-wide configuration files. These files control the behavior of the system, network services, applications, and user settings.
/bin Directory
◦ The /bin directory contains binaries (executable programs) that are essential for the system to boot and run
/var Directory
◦ The /var directory tree is designated for storing data that is likely to change or vary during the system’s operation
/tmp
◦ The /tmp directory is designated for temporary files created by various program
/usr
◦ The /usr directory tree is typically the largest on a Linux system. It contains all programs and support files used by regular users, providing applications, libraries, and documentation
/opt
◦ The /opt directory is used for installing “optional” software packages, typically commercial software product
/dev
◦ The /dev directory is a special directory that contains device files. These files provide interfaces for devices attached to the system, such as terminals, printers, hard drives, and CD-ROMs
/lib
◦ The /lib directory holds essential shared libraries and kernel modules required by the system.
◦ It contains the main Linux library, libc
Challenge
Interactive Challenge: Filesystem Explorer
Objective: Use the terminal to navigate and explore the FHS.
- Open your terminal.
- Navigate to Root: Type
cd / and press Enter. You are now at the base of the filesystem.
- List Contents: Type
ls to see the directories listed above. Do you see /bin, /etc, /home, and /usr?
- Explore Your Home: Type
cd ~ or just cd to go directly to your home directory. Now type pwd to confirm your location. This is your personal workspace.
- Look at Configs: Type
cd /etc. Use ls | grep host to find files related to “hosts”. You can view the /etc/hosts file with cat hosts.
- Check Logs: Type
cd /var/log. Use ls to see the system log files. You can view the end of the main system log with sudo tail -f syslog (press Ctrl+C to exit the live view).