fachtnaroe.net
— because if it was easy, everyone would do it

  • Credits : John S and John C

Coding is one of the highest art forms achieved by mankind; an idea - just an electrical impulse - is made real in an alternate electronic universe; the created idea however, does not have physical form, and yet can change the physical world; it cannot be touched, and yet may touch all mankind.

Linux Directory Structure

The directory structure of Linux is quite intimidating for the new user, particularly if they are migrating from Windows. In Windows, almost all programs install their files in the directory named C:\Program Files. The Windows operating system proper lives in C:\Windows. This is not the case for Linux. The directory structure places files in different directories based on function. For example, all configuration files for all applications are in /etc, all system binary files are in /sbin. This table shows most of the directory structure and directory contents.

/
'root' directory which is the start of the Linux file system. All files, directories and devices are contained logically inside the root directory regardless of their physical location
/bin
Contains the binary (executable) programs that are part of the Linux operating system. Many common commands such as cat, cp, df, ls, more, and tar, are here
/boot
Contains the Linux kernel and other files needed by the boot manager to boot (start) the operating system
/dev
Linux treats each device as a special file; those files are located here. Some interesting files such as /dev/null (the 'bit-bucket') are here (anything sent to the bit-bucket disappears)
/etc
Contains almost all system configuration files as well as system initialisation scripts
/home
This is the parent directory of the home directories of users
/lib & /lib64
Contain library files, including loadable driver modules, used by and shared between programs
/lost+found
Lost files directory; there's one on every disk partition
/media & /mnt
Temporary & removable file systems are mounted under these eg CD, DVD drives, USB flash memory, cameras
/opt
Optional software packages install files here eg Google Chrome, Adobe Reader
/proc
A quite cool virtual filesystem, in which the contents of files show values relevant to the operation of the system. Changing these values (if you have that permission) changes the operation of the computer eg Changing /proc/sys/net/ipv4/tcp_keepalive_time can help if your ssh connections freeze
/root
The home directory of the root user
/sbin
Contains system binary (executable) files. Commands such as fdisk, mount, shutdown, umount live here
/sys
Another virtual filesystem; a directory where files contain information about devices, as seen by the Linux kernel
/tmp
Temporary directory which is used as storage for temporary files. The contents of this directory are intended to be cleared each time the system boots
/usr
This holds user installed binaries. It contains subdirectories (confusingly) similar to the root file system.
/usr/sbin
Has further system function binaries
/usr/share
Contains files that are shared such as default configuration files, images etc
/usr/src
Contains the source code for the Linux kernel (if that has been installed)
/var
Contains various writeable system and application files such as logs, mail directories, databases, print spooling etc which tend to change in numbers and size over time; these should survive past reboot
/var/www/html
or
/var/www/htdocs
Contains the files served by the web server
/var/www/cgi-bin
Contains cgi programs which are run by the web server; the output of the programs is then served (prefix your program output with "Content-type: text/html\n\n" so the web server knows what to do with it!)
Last updated: 20150326-09:42