File System Layout
The first noticeable difference between Slackware Linux and a DOS or Windows system is the filesystem. For starters, we do not use drive letters to denote different partitions. Under Linux, there is one main directory. You can relate this to the C: drive under DOS. Each partition on your system is mounted to a directory on the main directory. It’s kind of like an ever-expanding hard disk.
We call the main directory the root directory, and it’s denoted with a single slash (/). This concept may seem strange, but it actually makes life easy for you when you want to add more space. For example, let’s say you run out of space on the drive that has /home on it. Most people install Slackware and make one big root drive. Well, since a partition can be mounted to any directory, you can simply go to the store and pick up a new hard drive and mount it to /home. You’ve now “grafted” on some more space to your system. And all without having to move many things around.
Below, you will find descriptions of the major top level directories under Slackware.
- Essential user programs are stored here. These represent the bare minimum set of programs required for a user to use the system. Things like the shell and the filesystem commands (ls, cp, and so on) are stored here. The /bin directory usually doesn’t receive modification after installation. If it does, it’s usually in the form of package upgrades that we provide.
- Files that are used by the Linux Loader (LILO). This directory also receives little modification after an installation.
- Remember that all drives have to be mounted to a directory on the main root directory? Well, /cdrom is provided as a mount point for your CD-ROM drive.
- Everything in Linux is treated as a file, even hardware devices like serial ports, hard disks, and scanners. In order to access these devices, a special file called a device node has to be present. All device nodes are stored in the /dev directory. You will find this to be true across many UNIX-like operating systems.
- This directory holds system configuration files. Everything from the X Window configuration file, the user database, to the system startup scripts. The system administrator will become quite familiar with this directory over time.
- Linux is a multiuser operating system. Each user on the system is given an account and a unique directory for personal files. This directory is called the user’s “home” directory. The /home directory is provided as the default location for user home directories.
- System libraries that are required for basic operation are stored here. The C library, the dynamic loader, the ncurses library, and kernel modules are among the things stored here.
- When the system boots, the filesystems are checked for any errors. If errors are detected, the fsck program is run to see if any can be corrected. The corrected parts of the filesystem are written to the /lost+found directory.
- This directory is provided as a temporary mount point for working on hard disks or removable drives.
- Optional software packages. The idea behind /opt is that each software package installs to /opt/<software package>, which makes it easy to remove later. Slackware distributes some things in /opt (such as KDE in /opt/kde), but you are free to add anything you want to /opt.
- This is a unique directory. It’s not really part of the filesystem, but a virtual filesystem that provides access to kernel information. Various pieces of information that the kernel wants you to know are conveyed to you through “files” in the /proc directory. You can also send information to the kernel through some of these “files”. Try doing cat /proc/cpuinfo.
- The system administrator is known as “root” on the system. root’s home directory is kept in /root instead of /home/root. The reason is simple. What if /home was a different partition from / and it could not be mounted? root would naturally want to log in and repair the problem. If his home directory was on the damaged filesystem, it would make it difficult for him to log in.
- Essential programs that are run by root and during the system bootup process are kept here. Normal users will not run programs in this directory.
- The temporary storage location. All users have read and write access to this directory.
- This is the big directory on a Linux system. Everything else pretty much goes here, programs, documentation, the kernel source code, and the X Window system. This is the directory to which you will most likely be installing programs.
- System log files, cache data, and program lock files are stored here. This is the directory for frequently-changing data.