What are directories in Ubuntu

This is how the Linux folder structure works

Thomas Hümmler

Regardless of whether it is / home, / sbin or / mnt - anyone who understands the structure of Linux folders can partition more easily and make better use of programs and media.

EnlargeIf you understand the structure of Linux systems, you can easily partition the hard drive and know where programs and user files are located.

While Windows systems still adhere to peculiarities such as drive letters, the operating systems Mac OS X and Linux have long since converged: They use a common directory structure, starting from the root directory “/”, also called root.

The fact that there is this uniformity in terms of directory contents and names is thanks to the so-called Filesystem Hierarchy Standard, or FHS for short. This describes the structure of a Unix directory system. Since there are no drive letters, partitions, hard disks and other storage media such as USB sticks and DVD drives are simply integrated into the directory structure as folders, ie "attached" or "mounted". Theoretically, a medium such as a DVD or USB disk can be attached at any point. In practice, however, certain locations are provided for this, primarily the “/ mnt” and “/ media” directories.

This article comes from the special issue PC-WELT XXL: Linux instead of Windows!

Linux instead of Windows - this is how you use Ubuntu & Mint, Linux without risk in addition to XP, 7 & 8.1, move all data from Windows. Plus: Seven complete Windows alternatives on DVD.

You can take advantage of this fact when setting up a Linux system by distributing the system over several hard disks or partitions. If you do this cleverly, you will prevent uncontrolled overflow of the physical memory or, in the event of an emergency, you can quickly move the user data to another server or another hard drive.

Linux for every purpose and user

Root (/): The root directory

At the top of the entire Linux directory system is the root directory, also called root, represented by the slash.

What is in the root file system must be enough to boot or repair a Linux system. This requires diagnostic, backup and restore utilities as well as configuration files and boot loader information. Important commands like mount must therefore be directly accessible. Since the root directory usually only contains folders, it is imperative that all subdirectories including the programs are present on the root partition.

However, this root partition does not have to be very large. On the contrary: It is advisable to keep this as small as possible so that the system can even be started from a USB stick. In addition, a small root partition is less prone to damage, for example as a result of a system crash.

EnlargeSystem commands: In the “/ bin” directory you will find tools for copying, deleting and moving files, for unpacking archives or for editing rights.

/ bin: Substantial system tools

The directory “/ bin” must be on the root partition. Here are important system tools that all users can run.

These commands must also be executable if no other file system is mounted. In the "/ bin" directory you will find, among other things, system commands for file rights ( chgrp, chmod, chown) , for copying, creating, moving and deleting directories and files, for logging in and mounting file systems, the sh shell and the su program, which can be used to change the user ID.

The archive tools tar and cpio as well as the pack programs gzip and gunzip are also housed in “/ bin”. The administrator can use these to restore a system, provided the root file system is intact. Other fundamental command line tools are netstat, ping ftp and tftp.

EnlargeOn this system, the boot loader was given its own small partition. This is necessary if the system is encrypted or uses the Btr fs file system.

/ boot: The boot loader

The directory “/ boot” does not necessarily have to be on the root partition. It contains the static files of the boot loader - such as Grub 2 - as well as all files required for the system start. The system kernel can also be found here, if it is not stored directly in the root directory.

/ dev: The device files

The “/ dev” directory and its contents are required on the root partition. This directory contains character and block-oriented special files that are used to control access to devices such as hard disks and DVD drives or interfaces.

/ etc: The system configuration

The “/ etc” directory belongs again to the root partition. Because there and in the directories below are the files for the system configuration. Some of the directories under “/ etc” must be available on every Linux system, others are optional. The configuration files for the X window subsystem, the prerequisite for the graphical desktop user interface, can be found in the “/ etc / X11” directory. There may also be the “/ etc / opt” directory. There you will find the configuration files of packages from the “/ opt” directory.

EnlargeSweet "home": Every system user receives a home directory in which he has all rights and can accommodate his own files and configurations.

/ home: My files

The directory “/ home”, which contains the home directories of all users, can also be located on a different partition. For each user of a Linux system, you will find a folder here that bears the user name. The own home folder is the only folder where a user has all access rights. Here he can create directories, delete files and save configuration data.

It has advantages to create the directory “/ home” on a different partition, better still on a different hard drive: You can update the system relatively easily and then re-integrate the user directories. These remain unaffected by the update.

Another advantage: If no user quotas are defined, a user can use any amount of hard disk space for his home directory and thus theoretically cause the entire system to overflow.