System Directories

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.

Directory scope, category, and application

Figure 1-4. Directory scope, category, and application

Directory path part 1: category

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

bin

Programs (usually binary files)

sbin

Programs (usually binary files) intended to be run by the superuser

lib

Libraries of code used by programs

libexec

Programs invoked by other programs, not usually by users; think “library of executable programs”

Categories for documentation

doc

Documentation

info

Documentation files for emacs’s built-in help system

man

Documentation files (manual pages) displayed by the man program; the files are often compressed, or sprinkled with typesetting commands for man to interpret

share

Program-specific files, such as examples and installation instructions

Categories for configuration

etc

Configuration files for the system (and other miscellaneous stuff)

init.d

Configuration files for booting Linux

rc.d

Configuration files for booting Linux; also rc1.d, rc2.d, ...

Categories for programming

include

Header files for programming

src

Source code for programs

Categories for web files

cgi-bin

Scripts/programs that run on web pages

html

Web pages

public_html

Web pages, typically in users’ home directories

www

Web pages

Categories for display

fonts

Fonts (surprise!)

X11

X window system files

Categories for hardware

dev

Device files for interfacing with disks and other hardware

media

Mount points: directories that provide access to disks

mnt

Mount points: directories that provide access to disks

misc

Mount points: directories that provide access to disks

Categories for runtime files

var

Files specific to this computer, created and updated as the computer runs

lock

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

Log files that track important system events, containing error, warning, and informational messages

mail

Mailboxes for incoming mail

run

PID files, which contain the IDs of running processes; these files are often consulted to track or kill particular processes

spool

Files queued or in transit, such as outgoing email, print jobs, and scheduled jobs

tmp

Temporary storage for programs and/or people to use

proc

Operating system state: see Operating System Directories

Directory path part 2: scope

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

/usr/X11R6

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.

Directory path part 3: application

The application part of a directory path, if present, is usually the name of a program. After the scope and category (say, /usr/local/doc), a program may have its own subdirectory (say, /usr/local/doc/myprogram) containing files it needs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.2.184