Directory hierarchy
Compared to Windows
Paths in Linux are different from Windows:
- There are no drive letters in Unix systems. Instead everything is in a directory under /
- The separator between directories is / instead of \
To illustrate the differences:
- A typical directory in Windows is C:\Users\Jarkko\some_directory
- A typical directory in Linux is /home/jarkko/some_directory
Directories
Directory | Contents |
---|---|
/ | Root directory, the very top of the tree. All other directories are beneath/inside it. |
/bin and /usr/bin | Binaries (programs). /bin is traditionally for the most important binaries that are needed during boot-up and for basic usage (such as ls, cp and mv). |
/sbin and /usr/sbin | System binaries. Programs that are not for normal users. |
/boot | For the Linux kernel and boot loader. |
/dev | It is a concept in Unix systems to expose devices (hardware in the computer) as files. Software can open these files to communicate with the hardware (via device drivers in the kernel). |
/etc | System-wide configuration files. |
/home | Holds the home directories of all users. This is where each users can put their own files. |
/root | The home directory of the root user (also called superuser or admin). |
/lib and /usr/lib | Shared libraries. The kernel modules are in /lib/modules. |
/lost+found | Recovered files from a disk check. There is a directory with this name for every partition. |
/mnt and /media | Place for temporary mount points. The /media directory was a later invention as place to temporarily mount removable media such as CD-ROMs. |
/proc | Kernel and process files. Like /dev these are not real files, but a way to interact with the kernel. Reading them gives information about the system and processes. Some can be written to give instructions to the kernel. |
/run | More recent invention. Run-time variable / transient data. It is information about the running system since it last booted. |
/srv | More recent invention. For data served by e.g. web and FTP servers. |
/sys | Information about devices, drivers and some kernel features. |
/tmp | Temporary files. There are also temporary files in /var/tmp. The difference is that the files in /var/tmp must be preserved between reboots. |
/usr | This is where the vast majority of data (such as binaries, libraries and documentation) is placed. This data is not essential during booting. |
/usr/local | Sometimes used to place everything that does not belong to the distribution. |
/var | Contains files that change frequently. Most useful for users is /var/log with log files. Other things include spools (for printing and mail) and lock files (created to indicate that a program has started). |