Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This
This chapter is from the book

Understanding How Linux Stores and Organizes Files

If you have not used Linux before, the way that Linux stores and organizes files is likely to be new to you because the layout is quite different from Windows and Mac OS X.

In the Windows world, each disk drive is labeled with an identifying letter such as C: for your hard disk and D: for the CD/DVD drive. In the Linux world, however, everything is part of the same filesystem organization. As such, if you have two or three hard disks, a CD drive, and a USB stick all plugged in, they will all be part of the same folder structure.

The diagram shown in Figure 4-9 should give you an idea of how everything hangs together.

Figure 4-9. Linux filesystem organization

Right at the top of the tree is the root folder, referred to as /. Inside this folder are a number of special system folders, each with a specific use. As an example, the /home folder contains a number of home directories for each user on the system. As such, the user account has the home folder set to /home/matthew.

Which Folder Does What?

The folder structure in a modern Linux distribution such as Ubuntu was largely inspired by the original UNIX foundations that were created by men with large beards. Although you don’t really need to know what these folders do, since Ubuntu looks after the housekeeping for you, some of you may be interested in the more important folders. To help, we present the Linux folder hit list in Table 4-1.

Table 4-1 Linux Folders




This folder contains important files to boot the computer, including the bootloader configuration and the kernel.


Each device on your system (such as sound cards, Webcams, etc.) has an entry in this folder. Each application accesses the device by using the relevant items inside /dev.


Systemwide configuration files for the software installed on your system are stored here.


Each user account on the system has a home directory that is stored here.


Important system software libraries are stored here. You should never need to delve into this world of the unknown.


Media devices such as CD drives and USB sticks are referenced here when they are plugged in. More on this later.


Other devices can be mounted too. Again, more on this later.


Optional software can be installed here. This folder is usually used when you want to build your own software. If you don’t build your own software, you ignore this folder.


Information about the current running status of the system is stored here.


This is the home directory for the main superuser.


Software that is vital for the system to be able to boot is stored here.


Software that should be run only by the superuser is stored here.


General software is installed here.


This folder contains log files about the software on your computer.

Configuration Files

In Table 4-1, /etc is described as storing systemwide configuration files for your computer. Aside from these files that affect everyone, there are also configuration files for each specific user. Earlier, when you customized Ubuntu’s look and feel, the settings were applied only to your current user account. So where are those settings stored?

Inside your home directory are a number of folders that begin with a dot (.), such as .config and .libreoffice. These folders contain the configuration settings for user-specific applications. By default, these dot folders are hidden in the graphical file viewer because you rarely need to access them. You can view these hidden files and folders when you are viewing your home folder by clicking View > Show Hidden Files in the menu or by pressing Ctrl-H.

Using Windows Files on Another Partition

For those of you who spend a considerable amount of your life on Windows partitions, you may want to be able to access these partitions from Ubuntu. This is no problem, although you will need to edit a special configuration file to do this. Luckily, you need to edit this file only once, and then everything will be set up.

Ubuntu should automatically recognize any Windows partitions you have on your computer and set them up for you; however, you may need to modify them or add your own. Search for Disk Utility in the Dash and write down the partition numbers and filesystem for your Windows partitions. The partition number will look something like /dev/hdb1 or /dev/sdb1, and the filesystem will be either FAT, VFAT, or NTFS.

The next step is to create some mount points. When your Windows partitions are enabled, they are accessed via a particular folder in Ubuntu. This is called a mount point. As an example, if you have a mount point as /media/win1 and on your Windows partition you want to access your Work folder, you would access it from Ubuntu as /media/win1/work.

Mount points usually live in the /media folder. Create a different mount point for each Windows partition. As an example, if you have three Windows partitions, run the following commands:

foo@bar:~$ sudo mkdir /media/win1
foo@bar:~$ sudo mkdir /media/win2
foo@bar:~$ sudo mkdir /media/win3

Now open up the following configuration file:

foo@bar:~$ sudo gedit /etc/fstab

The /etc/fstab file maps partition numbers to mount points. At the bottom of the file, add a line like this for each mount point:

/dev/hdb1 media/win1 vfat users,rw,owner,umask=000 0 0

You will need to change the partition number (the first column), mount point (second column), and filesystem (third column) for your relevant partitions.

Now reload /etc/fstab to enable the partitions:

foo@bar:~$ sudo mount -a

Some hard disk icons for the new partitions now appear.

  • + Share This
  • 🔖 Save To Your Account