Linux-Mandrake: |
User Guide and |
Reference Manual |
MandrakeSoft
January 2000 http://www.linux-mandrake.com
These days, a Unix system is big, very big, and that is particularly true with Linux: the profusion of software available would make it an unmanageable system if there were not guidelines for the location of files in the tree structure.
The acknowledged standard in this respect is FHS
(Filesystem Hierarchy Standard), which is on
version 2.0 at the time of writing of this manual. The document which
describes the standard is available on the Internet in different
formats at URL http://www.pathname.com/fhs/
. This chapter gives
only a brief summary, but it should be enough to teach you in what
directory to look for (or place) a given file.
Data on a Unix system can be classified according to these two criteria. You will have guessed what they both mean: shareable data is data that can be common to several machines in a network, while unshareable data cannot be. Static data must not been modified in normal use, while variable data can be. As we explore the tree structure, we will classify the different directories into each of these categories.
Note that these classifications are only recommended. You are not
obliged to follow them, but adopting these guidelines will greatly help
you manage your system. Note, too, that the static/variable
distinction only applies to the use of the system and not its
configuration. If you install a program, you will obviously have to
modify "normally" static directories, e.g. /usr
.
/
The root directory contains the whole system hierarchy. It cannot be classified since its subdirectories may or may not be static or shareable. Here is a list of the main directories and subdirectories:
/bin
: essential binary files. This directory contains the
basic commands which will be used by all users and are necessary to the
operation of the system: ls
, cp
, login, etc.
Static, unshareable.
/boot
: contains the files required by the Linux
boot manager (LILO for Intel platforms). This may or
may not contain the kernel: if it is not here, it must be located in the
root
directory. Static, unshareable.
/dev
: system device files (dev
for
DEVices). Static, unshareable.
/etc
: this directory contains all the configuration files
specific to the machine.
/home
: contains all the personal directories of users of
the system. This directory may or may not be shareable (some large
networks make it shareable by NFS), and it is obviously variable.
/lib
: this directory contains the libraries essential to
the system and the kernel modules, in /lib/modules
. All the
libraries required by the binaries in directories /bin
and
/sbin
must be located here, together with the linker
ld.so
. Static, unshareable.
/mnt
: directory containing the mounting points for the
temporary file systems. Variable, unshareable.
/opt
: this directory contains packages not required for
system operation. It is recommended to place static files (binaries,
libraries, manual pages, etc.) for such packets in
/opt/package_name
and their specific configuration files for the
machine in /etc/opt
.
/root
: personal directory of the Almighty. Variable,
unshareable.
/usr
: see next section. Static, shareable.
/sbin
: contains the system binaries essential to system
startup, operable by root
only. A normal user can also run them
but will not get very far. Static, unshareable.
/tmp
: directory intended to contain temporary files which
certain programs may create. Variable, unshareable .
/var
: location for data which may be modified in real time
by programs (e.g. the e-mail server, audit programs, the print server,
etc.). All of /var
is variable, but its different subdirectories
may be shareable or unshareable./usr
: the big oneThe /usr
directory is the main application storage directory.
All the binary files in this directory must not be required for the
system startup or maintenance, since the /usr
hierarchy is very
often a separate filesystem. Given its often large size, /usr
has
its own hierarchy of subdirectories. We will mention just a few:
/usr/X11R6
: the whole X Window System hierarchy. All the
binaries required for the operation of X (obviously including
the X servers) and all the necessary libraries must be located
in it. The /usr/X11R6/lib/X11
directory contains all aspects of
the configuration of X which do not vary from one machine to
another. Specific configuration for each machine is in /etc/X11
.
/usr/bin
: this directory contains the large majority of the
system's binary programs. Any binary program which is not
necessary to the maintenance of the system and is not a system
administration program must be located in this directory, apart from
programs you install yourselves, which must be in /usr/local
.
/usr/lib
: this directory contains all the libraries
necessary to run programs located in /usr/bin
and
/usr/sbin
. There is also a symbolic link /usr/lib/X11
pointing to the directory which contains the X Window System libraries,
/usr/X11R6/lib
(if X Window System is installed, of course).
/usr/local
: this is the directory where you should install
your personal applications. The installation program will have created
the necessary hierarchy: lib/
, man/
, etc.
/usr/share
: this directory contains all the data required
by the applications in /usr/
, and all the independent
architecture data. Among other things, you will find in it zone and
location information (zoneinfo
and locale
).There are also /usr/doc
and /usr/man
directories, which
respectively contain application documentation and the system manual
pages, but the standard recommends they be eventually moved to
/usr/share
.
/var
: data modifiable during useThe /var
directory contains all the operating data for programs
running on the system. Unlike the working data in /tmp
, these
data must be kept intact on the event of a reboot. There are many
subdirectories, and some are very useful:
/var/log
: contains the system log files;
/var/spool
: contains the system daemon working files. For
example, /var/spool/lpd
contains the print server working files
and /var/spool/mail
e-mail server working files (i.e. all mail
arriving on and leaving your system).
/var/run
: this directory is used to keep track of all
processes being used by the system, so that you can act on these
processes in the event of a change of system runlevel (see a previous
chapter)./etc
: configuration filesThe /etc
directory is one of the essential directories in any
Unix system. It contains all the basic system configuration
files. Please do not delete it to save space! Likewise, if you want to
extend your tree structure over several partitions, remember that
/etc
must not be put on a separate partition: it is needed for
system initialization.
Some important files are:
passwd
and shadow
: these two files are text files
which contains all the system users and their passwords (encrypted
:)
). shadow
is only there are if you use shadow passwords,
but it is the default installation option;
inittab
: is the configuration file for the program
init
, which plays a fundamental role when starting up the
system, as we will see later on;
services
: this file contains a list of existing network
services;
profile
: this is the shell configuration file,
although certain shells use others. For example, Bash uses
bashrc
;
crontab
: configuration file of cron
, the program
responsible for periodic execution of commands.There are also certain subdirectories for programs which require large
numbers of files for configuration. This applies to X Window System, for
example, which has the whole /etc/X11
directory.