Learn Linux Directory Structure in a Shiny Sketch

Linux is an operating system which popular in server world. But now there are a lot of Linux distributions which also expand to desktop world. As the Linux usage grows, now Linux has Graphical User Interface (GUI) which make easier to used.

But the power of Linux stays in the background. The console. When there are something that can’t be done via GUI, you better try to use console mode. Before doing that, it’s better for us to know about Linux directory structure.

linux cheat sheet

The file structure

If you are coming from Microsoft Windows users, then you will found that Linux file structure is not different from Microsoft Windows. Here’s the comparison between them.

NoLinux DirectoryFunctionComparison with Microsoft Windows 7
1/The top directory of LinuxC:\
2/binStore binary files which related to the system such as mount, ls, rm, etcC:\Windows
3/bootStore files related to boot processC:\Windows
4/devStore information about all devices which connected to your LinuxC:\Windows
5/etcStore configuration files about Linux and its applicationC:\Windows
6/homeUser directoryMy Documents
7/libStore library filesC:\Windows\system
8/lost+foundlost+found is the directory in which fsck (filesystem check) will put files it restores from orphaned blocksFound.000
9/mediaUsually used as a moint point for external media such as CD/DVD ROMD: or E: drives
10/mntUsed as a mount point directory, but it more likely a place that “temporarily mounted” device such as network shares.A mapped drive such as X: , Y:, Z:
11/optStore files which not handled by package managerNone
12/procA virtual filesystem which used to provide information about the systemC:\Windows\system or C:\Windows\System32
13/rootAs root home directoryMy Documents for Administrator
14/sbinStore a binary files which usually can be run by superuser onlyC:\Windows
15/selinuxStore information about Security Enhanced. Some Linux distributionmay not have this directoryNone
16/srvStore data services which used by systemNone
17/sysStore information related about your Linux systemC:\Windows\system or C:\Windows\System32
18/tmpUsed as a temporary folder for applicationsC:\Windows\Temp
19/usrStore user utilities and applicationsC:\Program Files or C:\ProgramData
20/varStore variable data filesNone

 

Below is a screenshot of CentOS 6.4 directory structure look like.

Linux directory structure CentOS 6.4

But again, on Debian based Linux, such as Ubuntu, the structure may a little bit different. Below is a screenshot of directory structure on Ubuntu 13.04

Ubuntu 13.04 directory structure

On Ubuntu 13.04, we have /cdrom directory while on CentOS 6.4 we don’t have it. But generally, the structure is identical.

Then we see that on Ubuntu 13.04 keeps a symbolic link of initrd.img and vmlinuz files below the / partition while on CentOS 6.4 we don’t find it.

More information about the structure

When you access /usr directory, we will found that /usr directories partly replicate root ( / ) directory. The content of /usr directory of CentOS 6.4 is like this :

  • /usr/bin is a directory that store binary files which related to common usage such as clear, gcc, bunzip2
  • /usr/etc is a directory that store application configuration files
  • /usr/games is a directory that contain of games applications
  • /usr/include is a directory that store header files
  • /usr/lib is a directory that store library files
  • /usr/libexec is a directory that store library files in binary form
  • /usr/local is a directory that usually used as a placed for additional user applications
  • /usr/sbin is a directory that store user application binary files which require superuser privileges
  • /usr/share is a directory that usually keeps documentation files of application that installed in your Linux
  • /usr/src is a directory which keeps the source files of the user application
  • /usr/tmp is a directory that used as a temporary folder for applications. This folder may point /var/tmp directory

If you dig deeper to /usr/local, then you will found an identical /usr replicate there.

/usr vs /usr/local

The tmp directory actually is a symbolic link / shortcut to /var/tmp directory.

The above screenshot was captured from CentOS 6.4. On Ubuntu 13.04, we found almost identical directory structure inside /usr and /usr local.

/usr vs /usr/local on Ubuntu

Conclusion

Linux may have a lot of distributions. But with standardized directory structure, it will make easier for us to understand what’s the function of each directories. If you are a Linux enthusiast who likes to try various Linux distributions, you will not find any trouble in figuring out the usage of each directories. For a Linux Administrator, it will shorten the learning curve for each Linux distributions.

About Pungki Arianto

Pungki , currently working as a Linux / Unix administrator for a banking company. He love to work in Linux / Unix since it's fun for him. He is also interested in information technology, information security and writing.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.

1 Comment