How does Linux's file structure work?

A Linux directory is a special file that acts as a container for other files and even other directories. You can create directories to hold groups of related files as an alternative to keeping all your files in one huge directory.

A Linux file system is like a filing cabinet with a bunch of folders, each of which can contain subfolders and files.

After installing Linux and creating a new hermie user account, you’ll end up with a file system hierarchy like the one shown here.


              /                            <-- The root of the file system
              |    
              | 
 +------------+-------------+
 |   |   |    |    |   |    | 
 |   |   |    |    |   |    | 
bin dev etc home sbin root usr   <-- Directories below the root
              |   
        +-----+-----+  
        |           |
      hermie     sigmund         <-- User home directories

Figure 1-1

As you can see, the file system resembles an upside-down tree and is very similar to the treelike directory structure in DOS. The top level is denoted by a slash (/) and is called the root directory. Several system-related directories such as bin, dev, and etc appear below the root directory–here’s a summary of their purpose in life:

/bin Contains the Linux system commands and programs (also called binaries). Pronounced “slash bin.”

/dev Contains special device files that correspond to hardware components. Pronounced “slash dev.”

/etc Contains configuration files for Linux and other installed software. Pronounced “slash et-see.”

/home Contains the home directories (personal storage) for each user on the system. Pronounced “slash home.”

/sbin Contains more Linux binaries (special utilities not for general users). Pronounced “slash ess-bin.”

/root The home directory for the root user; not to be confused with /. Some Linux systems use /home/root instead of /root. Pronounced “slash root.”

/usr Contains system programs and other files for general users such as games, online help, and documentation. By convention, a user should not put personal files in this directory. Pronounced “slash user.”

Note: Unless you are an All-Knowing Linux Guru, you should never combine or delete any of the directories (or files therein) that appear just below the root directory. This could prevent your system from booting or operating properly.