Posted: . At: 6:33 PM. This was 12 years ago. Post ID: 2916
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

The Linux file-system tree explained.

The Linux file-system tree explained.

The standard Linux installation is laid out in various folders that each have a different role to play in the smooth running of a Linux distribution.

|-/
|-/bin
|-/boot
|-/dev
|-/etc
|-/home/username
|-/lib
|-/lost+found
|-/mnt
|-/proc
|-/root
|-/sbin
|-/tmp
|-/usr
|-/usr/local
|-/var

The / folder is the root directory of a Linux directory structure. There are the . and .. entries above the / folder, but this is the topmost folder and the root directory parents itself.

The /bin folder contains all of the basic Linux commands that are installed by the GNU Coreutils package such as rm, ls, cp, and cat. The commands installed in this folder may be run by any user.

/boot is where the Linux kernel images and associated files reside. Usually, they are named vmlinux although they may be named bzImage as well.

/dev The dev directory is where the Linux operating system stores its device files. For example a DVD drive would be /dev/sr0. The device file /dev/null is a bit bucket, files written to this device are immediately erased.

The /etc directory contains the configuration files for the various Linux programs that are installed on your system as well as the configuration for the bash shell and other miscellaneous Linux settings, such as configuring boot scripts and compilation settings in the case of a Gentoo system.

The /home folder contains various subdirectories that contain home folders for each user that exists on a Linux system. Some users on a Linux machine merely exist to allow various packages to function and do not have a home folder.

The /lib directory contains the various shared libraries used by Linux programs to function. The purpose of a shared library is that code can be shared from the one library to many programs instead of every program needing to include that code themselves.

The /lost+found directory contains files restored after a major system malfunction. Linux will run file-system checks after a system crash and what data can be recovered will be stored here.

On most Linux systems, the /mnt folder will be used to mount various file-systems allowing the data to be accessed. Nowadays the /media folder will be used automatically when a file-system such as a USB drive or hard disk is mounted.

The /proc folder contains a range of virtual files that are representations of the various functions of your Linux machine. There are files such as /proc/meminfo that contain a wealth of information about the memory of your computer. And the /proc/version file that contains a string of text that tells you which kernel version you are running. The files in here can be written to, this will change system operation, e,g to drop caches or other system changes. This will be reset on boot.

The /root directory contains the home folder for the root user on a Linux system. it is the same as the other home directories under /home, but it is only for the root user.

The /sbin directory is similar to the /bin directory, but it is reserved for system administration programs and you need to have system administration access to be able to run the programs in this directory.

The /tmp folder is the place where the Linux programs store their temporary data. This directory is readable and writable by the normal user and is very useful for creating temporary files when you are performing various Linux tasks.

The /usr directory contains the /usr/bin and /usr/share folders that contain system installed programs and the various resources needed by those programs respectively.

The /usr/local directory is the same as the /usr directory, this is where programs will be installed by default if you are installing from source. It is a good idea to install programs you have compiled yourself into the /usr/local folder and keep the /usr directory for programs installed through the package manager.

The /var directory is a place to store files on your Linux system that will change and be archived over time, such as the printer spools and the various log files such as /var/log. The mail files also reside in this directory. It is a good idea to read the files under /var/log to keep an eye on system activity.

Source: http://www.securitronlinux.com/lc/pocketbook2003.pdf, page 92.

1 thought on “The Linux file-system tree explained.”

  1. It’s also notable that you can directly manipulate some files in /proc for one-time actions (echo 3 > /proc/sys/vm/drop_caches) or to actually change system settings (echo 1 > /proc/sys/kernel/sysrq).

    This harks back to Dennis Ritchie’s UNIX philosophy of making everything based on text data (like the entries in /proc) rather on than binary data (such as the Windows Registry) as text is a human-readable format and enables in-depth interaction with, and automation of tasks on, the system.

    Reply

Leave a Reply to Super Jamie Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.