Touring The Linux File System

  Home > Tips & Tweaks > Linux > Touring The Linux File System

Touring the Linux File System


After a fresh install, many newcomers to Linux frantically search for the “C” drive, the Windows mentality firmly embedded deep within their brains. So, where is everything located in a UNIX-like environment? What's the geography of this alien file system? Help!


Everything under Linux and any UNIX-like system is located under a single directory called the “root”, and it's designated by a slash “/”. Everything you'll ever install, create, modify, store and cache will be located under this root directory; it's easier to imagine this structure as an upside-down tree, with its roots being at the top rather than at the bottom.


There's no concept of each hard drive receiving its own drive letter in Linux. Instead, the concept of a physical hard drive is abstracted to the point where it becomes just another directory under the root directory; this abstraction makes for a very clean and consistent layout that's familiar and easy to manage.


One of my pet peeves with various Linux distributions is their annoying habit of altering the standard file system to fit their unique distro. Why follow a standard when you can deviate from it and confuse users, right? One of the many reasons why I advocate the Slackware distribution is because of their adherence to standards: Slack uses the familiar standard Linux layout.


Fire up a shell and do this:


liquidbinary@arrakis:~$ cd /

liquidbinary@arrakis:/$ dir


The first command navigates to the root directory and the second runs the “dir” command to show its contents, displaying all directories under the root.


What are all those directories with the strange names?




The “bin” directory is a special place for programs. Important programs—required to make the system usable—are located here. Things like file system commands and your shells reside in the bin directory, quietly awaiting execution (not as morbid as it sounds).




Linux uses the “boot” directory as a storage location for tools to help it load when it boots up. The Linux Loader (LILO) or the Grub boot loader may be living in here.




Linux uses an ingenious abstraction method for hardware; it presents tangible hardware devices—hard disks, scanners, serial ports and suchlike—as special files called “device nodes” under the “dev” directory; this makes it easy for programs to extract information from these so-called “device nodes” as if they were actual files. This device node abstraction can be found across many UNIX-like operating systems.




The “etc” directory is the storehouse for configuration files. There isn't a main “registry” for configuration settings like there is on a Windows OS. Instead, most programs store their config files in this directory or in your home directory, which I'll get to next.




All UNIX-like systems were designed from the ground-up to be a multi-user environment. Each user has a personal “home” directory that they are automatically dropped into when they first log in. Anything can be done in this private directory, as the user has full access privileges; it's their own little private space on the system.




Pieces of “shared” code called libraries are stored in this essential directory. Programs often have a need to utilize a common code routine, and if each program implemented a common functionality all the time, there would be a lot of duplicate code sucking up precious resources. Instead of re-inventing the wheel each time a routine is needed, programs can access a “code library” to get at what they need.




Recall that storage hardware is not given a drive letter; it's mounted somewhere under the root directory. The “mnt” directory is the usually the place were storage mounts take place.




The “proc” directory is not really a part of the file system; it's unique in its own right, as it's usually described as a “virtual file system” that can be interrogated for kernel information. Linux makes various pieces of kernel information available via files which can be found in this special directory.




The omnipotent master of the system is always known as root. Root can do anything, including deleting the entire root directory and its contents with a single command (don't try this at home). The root user is given a special directory that's separate from the lower users' home directories, as is only appropriate for any digital aristocrat.




This is where root's arsenal of specialized programs is stored; they are usually executed during boot time. All other users are forbidden access to this clandestine directory.




Everyone has read/write access to this temporary directory; it's good for experimenting with prospective software packages when you don't want to shoot yourself in the foot by actually installing it.




This is where everything else goes: documentation, various programs, kernel source code and others. Most programs will install themselves in this gigantic directory.




The “var” directory is for data that changes a lot. Log files that need to be frequently updated and cache data fit into this category.


You should now feel a little more comfortable navigating around your Linux system. Once you get the hang of it, you'll soon gain an appreciation for the clean, consistent layout that Linux employs for its users' benefit.

More On Linux

-SuSe Linux

-Partition Your Hard Drive For Linux

-Make A Start Up Disk For Linux

-Touring the Linux File System

Back To Tips Homepage



Popular Articles:

How To Build A PC | Different Types of Keyboards | Help with Hard Drive Installation | Computer Networking Basics | Introduction of Motherboard Functions | Computer CPU Processor Speed | Upgrade from Windows 95 to Windows 98 | Computer Monitor Troubleshoot | Partition Hard Drive | Installing New CPU Processor | Types of Network Cables

Popular Topics
Building A PC
How To Guide
Tips & Tweaks



1999-2010 All rights reserved ©