CIS120Linux Fundementals
Understanding the Linux File System
The Linux file system is structured quite differently from Windows. It uses a hierarchical directory structure where everything starts from the root directory, denoted by a single slash (/
), and branches out into various other directories each with its specific purpose. In this discussion, we'll cover the main directories you'll encounter in a Linux system and what they're typically used for.
Basic Structure of the Linux File System
/
(Root Directory): At the top of the file system hierarchy, the root directory contains all other directories and files. It is the starting point of the file system./bin
(User Binaries): Contains essential user binaries (programs) that are generally needed by both the system administrator and normal users./sbin
(System Binaries): Like/bin
, this directory holds binaries, but these are usually not intended for access by ordinary users. They are essential for system administration (e.g.,init
,ip
,mount
)./etc
(Configuration Files): Contains configuration files required by all programs. This also includes startup and shutdown shell scripts used to start/stop individual programs./dev
(Device Files): Includes device files, which are special files that either represent or are connected to hardware devices, including terminal devices, usb, or any device attached to the system./proc
(Process Information): A virtual file system containing information about system processes. It's mapped to/proc
and isn't a real file system in that it doesn't use disk space./var
(Variable Files): Contains files that are expected to grow in size, such as logs (/var/log
), spool files, and cached data./tmp
(Temporary Files): Intended for storage of temporary files./usr
(User Programs): Used for all user-related programs, libraries, documentation, etc. It contains multiple subdirectories, including:/usr/bin
for binary files/usr/sbin
for system binaries/usr/local
for user programs installed from source or software not officially shipped with the distribution
/home
(Home Directories): Contains the personal directories of all users. Each user has a directory named after their user account within/home
where they store their personal files./boot
(Boot Loader Files): Contains files needed to start the boot process, including the Linux kernel itself and the boot loader (e.g., GRUB)./lib
(System Libraries): Contains essential shared libraries and kernel modules needed to boot the system and run commands in root file system.
Examples of Navigating and Understanding the Linux File System
1. Listing configuration files
You might want to see what configuration files are present for system-wide settings:
ls /etc
2. Checking mounted devices
To see all currently mounted devices and their partitions, you can look at:
cat /proc/mounts
3. Viewing user-specific binaries
If you want to check what binaries are available for all users:
ls /usr/bin
4. Exploring your home directory
To navigate to your home directory and see its contents:
cd ~ # ~ is a shortcut for /home/yourusername
ls
5. Viewing system logs
To check system logs, such as messages related to system functions:
sudo less /var/log/syslog
Conclusion
The Linux file system's hierarchical structure is designed to segregate and organize files in a logical manner, enhancing security, scalability, and manageability. By understanding the role of each directory within this structure, users and administrators can manage their systems more effectively. This model also supports permissions and ownership, making it highly versatile for multi-user and multi-process operations.