A typical Linux system has tens of thousands of system directories. These directories contain operating system files, applications, documentation, and just about everything except personal user files (which typically live in /home).
Unless you’re a system administrator, you’ll rarely visit most system directories—but with a little knowledge you can understand or guess their purposes. Their names often contain three parts, which we’ll call the scope, category, and application. (These are not standard terms, but they’ll help you understand things.) For example, the directory /usr/local/share/emacs, which contains local data for the emacs text editor, has scope /usr/local (locally installed system files), category share (program-specific data and documentation), and application emacs (a text editor), shown in Figure 1-4. We’ll explain these three parts, slightly out of order.
A category tells you the types of files found in a directory. For example, if the category is bin, you can be reasonably assured that the directory contains programs. Common categories are:
Categories for programs | |
Programs (usually binary files) | |
Programs (usually binary files) intended to be run by the superuser | |
Libraries of code used by programs | |
Programs invoked by other programs, not usually by users; think “library of executable programs” | |
Categories for documentation | |
Documentation | |
info |
Documentation files for emacs’s built-in help system |
Documentation files
(manual pages) displayed by the | |
Program-specific files, such as examples and installation instructions | |
Categories for configuration | |
Configuration files for the system (and other miscellaneous stuff) | |
Configuration files for booting Linux | |
Configuration files for booting Linux; also rc1.d, rc2.d, ... | |
Categories for programming | |
Header files for programming | |
Source code for programs | |
Categories for web files | |
Scripts/programs that run on web pages | |
Web pages | |
Web pages, typically in users’ home directories | |
Web pages | |
Categories for display | |
Fonts (surprise!) | |
X window system files | |
Categories for hardware | |
Device files for interfacing with disks and other hardware | |
Mount points: directories that provide access to disks | |
Mount points: directories that provide access to disks | |
Mount points: directories that provide access to disks | |
Categories for runtime files | |
Files specific to this computer, created and updated as the computer runs | |
Lock files, created by programs to say, “I am running”; the existence of a lock file may prevent another program, or another instance of the same program, from running or performing an action | |
Log files that track important system events, containing error, warning, and informational messages | |
PID files, which contain the IDs of running processes; these files are often consulted to track or kill particular processes | |
Files queued or in transit, such as outgoing email, print jobs, and scheduled jobs | |
Temporary storage for programs and/or people to use | |
Operating system state: see Operating System Directories |
The scope of a directory path describes, at a high level, the purpose of an entire directory hierarchy. Some common ones are:
/ |
System files supplied with Linux (pronounced “root”) |
/usr |
More system files supplied with Linux (pronounced “user”) |
/usr/games |
Games (surprise!) |
/usr/local |
System files developed “locally,” either for your organization or your individual computer |
Files pertaining to the X window system |
So for a category like lib (libraries), your Linux system might have directories /lib, /usr/lib, /usr/local/lib, /usr/games/lib, and /usr/X11R6/lib.
There isn’t a clear distinction between / and /usr in practice, but there is a sense
that / is “lower-level” and
closer to the operating system. So /bin contains fundamental programs like
ls
and cat
, /usr/bin contains a wide variety of
applications supplied with your Linux distribution, and /usr/local/bin contains programs your
system administrator chose to install. These are not hard-and-fast
rules but typical cases.
3.145.2.184