At first, the Linux filesystem seems confusing for linoobs. But don’t worry, here is a quick guide to understand Linux (Ubuntu) Filesystem. The Linux Filesystem is very organized and easy to understand. The first thing you should know when working with linux, is that everything is treated as either a file or directory. Even hardware is considered a file by linux and all your hardware devices are located in the /dev directory. Another thing that confuses windows users, is the fact that linux doesn’t use drive letters to distinguish between different partitions and devices. The ‘root’ of your filesystem is ‘/’ whereas in windows it would most probably be C:\ . Drives in linux are “mounted” to directories where their data can then be accessed.
Sounds strange right? Well yes it does if you come from a windows environment, where the entire operating system is consolidated onto a single drive. However, with linux and the ability to mount devices as directories, it gives the end user much greater flexibility in splitting up their operating system over several drives or partitions. Here we go –
This is the root folder, all other folders come under root.. think of it as C:\ in a Windows context. The contents of the root filesystem must be adequate to boot, restore, recover, and/or repair the system.
This folder contains all the user-essential binaries (programs) that are needed to administer and run your linux system, delete this folder and your system is broken. It contains commands that may be used by both the system administrator and by users, but which are required when no other filesystems are mounted.
This folder contains configuration files and other necessary files that are needed by the bootloader. Thus /boot stores data that is used before the kernel begins executing user-mode programs. This may include saved master boot sectors and sector map files.
This folder contains special or device files. Be careful while working with it. Look through this directory and you should hopefully see hda1, hda2 etc. which represent the various partitions on the master drive of the system. It is a very interesting directory that highlights one important aspect of the Linux filesystem – everything is a file or a directory.
This folder contains all the configuration files used by the system, you can also start and stop services from here. It contains the following :
opt – Configuration for /opt
X11- Configuration for the X Window system (optional)
sgml- Configuration for SGML (optional)
xml- Configuration for XML (optional)
This folder contains the home folders of all the normal (non – root ) users on the system .. think of it as my documents in windows. It is clearly a site-specific filesystem & setup will differ from host to host.
This folder contains essential shared libraries and kernel modules. This directory contains those shared library images needed to boot the system and run the commands in the root filesystem, ie. by binaries in /bin and /sbin.
This is a mount point for removable media. This directory contains subdirectories which are used as mount points for removeable media such as floppy disks, CDroms, thumb drives etc.
This is a mount point for a temporarily mounted file-systems. This directory is provided so that the system administrator may temporarily mount a filesystem as needed. The content of this directory is a local issue and should not affect the manner in which any program is run.
Sometimes your system might crash or a power failure might take the machine down. Either way, at the next boot, a lengthy filesystem check will be done. Fsck will go through the system and try to recover any corrupt files that it finds. The result of this recovery operation will be placed in this directory.
This folder contains add on softwares. A package to be installed in /opt must locate its static files in a separate /opt/<package> or /opt/<provider> directory tree, where <package> is a name that describes the software package and <provider> is the provider’s registered name.
This folder contains binaries that can only be run as the root user (“superuser”).
This folder contains temporary files that are created while browsing, video buffering, system updates etc. and all the data is erased on reboot.
This folder and its subfolders contains user installed programs, utilities and libraries. Utilities used for system administration (and other root-only commands) are stored in /sbin, /usr/sbin, and /usr/local/sbin. /sbin contains binaries essential for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin.
The /var contains data that is changed when the system is running normally. It is specific for each system, i.e., not shared over the network with other computers.
This directory contains all the run time data a system administrator need while working. Everything is in one place making it easy for control purposes.
This folder contians the root user’s files. The root account’s home directory may be determined by developer or local preference, but this is the recommended default location.
This is a psuedo folder, that contains information about the linux kernel and hardware that is updated in realtime.
It contains data for services provided by this system. /srv contains site-specific data which is served by this system.
Now, things are clear in front of you what different directories are there and what are their functions. All these collectively make the Ubuntu (Linux) Filesystem. We can actually mount a seperate hard drive for each of these directories. For example, your /home can be put on another hard-drive than your / which means that you can easily recover your personal files if the harddrive on / fails because the harddrive mounted to your /home folder is seperate from the one that is mounted to your /. Simlarly /boot can also be made a separate paritition. It helps in easy management of bootloaders in dual-boot scenarios.
[Image Courtesy – Linuxconfig.org]