LKBEN10896: Folder Structure under Linux


Symptom

Simple description of standard Linux-folders and comparison to windows

Cause

Linux fundamentals

Solution

One of the fundamentals of Linux (actually: all Unixes) is the hierarchy of directories or folders. This is one of the part, migrants from windows sometimes find hard to understand, but Windows has a similar structure itself - it just has changed several times and never has been enforced as much as in Unix.
Another crucial thing about directories in Linux is the location, these directories are hosted. Unlike Windows, this (virtual) folder hierarchy has not to be located on the same machine. This way it's easy, to host certain structures (like applications or data) only once with access for many users and machines.
Other structures (like the kernel and drivers) MUST be locally (and by the way, nobody else cares about them...).
In other words, these folder hierarchies contain data, which is either static or variable, shareable over the network or unshareable (local).

Below you will find a list of the basic directory structure of Linux (and many Unixes) with a short explanation and (if possible) the comparable folder in Windows. In order not to complicate it, I just took the folders of 32 Bit Windows, in 64 Bit (and of cause 16 Bit!) - Windows these might differ slightly.

/bin
essential (Shell-) programs; static, shareable
Windows: %Systemroot%\ and %systemroot%\system32\

/boot
contains crucial files for booting up the system; most remarkable: kernel and drivers. static, unshareable
Windows: %Systemdrive%\, %Systemroot%\ and %systemroot%\system32\; There can be lots of different places like driverfolders too.

/dev
devices (f. ex. "/dev/hda"); static, unshareable
Windows: not easy to compare; since in the Linux philosophy everything is a file, devices (like CD-Rom, Floppy,...) must reside in the filestructure. In Windows the closest to this folder would be the Device Manager.

/etc
Important configurations for the System (for instance the "fstab" file). static, unshareable
Windows: no real equivalence; most likely INI files or the registry.

/home (f. ex. /home/<username>)
Folder for keeping User - homedirectories. This is the (only) region, a user has full access. variable, shareable
Windows: %Userprofile%: \Documents and Settings\<username>; from Vista on: \Users\<username>. Possibly the "my documents" folder further down.

/lib
essential libraries.
Windows: not exactly defined, most likely: %Systemroot%\ and %systemroot%\system32.
/lib/modules/<kernelversion>
Contains modules to be loaded dynamically into the Kernel.

/mnt
mounted devices (HD, CD-Rom, USB-Stick, DVD, floppy...);
Windows: devices (like harddisc, USB-Hostadapter) found under Device Manager, the mounted device would be represented most likely by the driveletter (C: --> harddisc, f.ex. f: for USB-Stick).

/opt
Folderstructure for installation or applications
Windows: \program files\

/proc (only Linux)
Not on every system: mounted virtual filesystem with informations about processes and system
Windows: no analogy; possibly tools like Taskmanager

/root
Homedirectory of user "root". Should not be needed often, since nobody is supposed to actually work with this account.
Windows: \Documents and Settings\<Administrator> (Vista: \Users\<Administrator>). The actual name of the local Administrator can differ; Microsoft encourages users not to work with this account, especially witch User Account Control (UAC) in Vista and later.

/sbin
Essential system binaries
Windows: no analogy

/tmp
Temporary files. Will be deleted upon next boot up.
Windows: obsolete: \TEMP; new: %Systemroot%\TEMP and userspecific: "\Documents and Settings\<User>\Local Settings\Temp"; however temporary files will usually not be deleted automatically by the system.

/usr
"universal system resources"; the most vital collection of files. static, shareable.
Windows: no analogy
/usr/X11R6
Grafic Subsystem (X11)
/usr/bin
User generated programs (binaries)
/usr/include
Default directory for include-files
/usr/lib
Libraries for user generated programs
/usr/local
Extra directory - hierarchy for user generated programs
/usr/sbin
non-essential system - binaries
/usr/share
Architecture-independend data
/usr/src
Directory for Sourcecode (optional)

/var
Directory structure, variable, unshareable
Windows: no analogy
/var/cache
application specific cache files
/var/lib
variable status informations
/var/local
variable data for "/usr/local"
/var/lock
Lockfiles
/var/log
Logfiles
/var/opt
variable data for "/opt"
/var/run
Relevant data for running processes
/var/spool
Spooling data (f.ex. files to be printed, not retrieved mails,...)
/var/tmp
Temporary files, NOT to be deleted upon reboot

 

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.