3. Linux File Systems
Contents
Filesystem hierarchy standard is maintained by the Linux Foundation, which defines the structure and contents of directories in various distributions of Linux.
File System Hierarchy
File System Hierarchy
Let’s look at what each of these directories means and what types of files are suitable for each of them.
home
The home directory of the users, this directory contains information about each user, such as startup parameters, and so on.
lib
Soft link of /usr/lib, stores library, contains kernel module files, static and dynamic libraries.
tmp
It is usually to store some newly downloaded installation packages that will be deleted immediately after the installation has been completed.
var
This directory is used to store files whose contents change frequently, and the program logs are generally stored here because the program often needs to read and write the record at the run time so that administrators can quickly locate the problem.
File Types
When you use the “ll” command to list all files in a directory, the first letter of each line is the type of file. Linux has 7 file types that can be classified into these 3 categories:
- Regular file types
- Directory file types
- Special file types
File Types
Let’s look at each of the 7 file types.
d (Directory file types category)
Each line of information printed by command “ll” begins with letter d is a directory file type.
- (Regular file types category)
Each line of information printed by command “ll” begins with symbol - is a regular file type.
l (Special file types category)
Each line of information printed by command “ll” begins with letter l is a symbolic link file type.
c (Special file types category)
Each line of information printed by command “ll” begins with letter c is a character device file type.
s (Special file types category)
Each line of information printed by command “ll” begins with letter s is a socket file type.
b (Special file types category)
Each line of information printed by command “ll” begins with letter b is a block file type.
p (Special file types category)
Each line of information printed by command “ll” begins with letter p is a named pipe file type.
File Naming Conventions
- No more than 255 characters in length
- The filename can’t contain slashes (/)
- Filenames are case-sensitive
File Paths
- Relative path: Starts from current directory, such as ./..
- Absolute path: Starts from root directory, such as /..
References Filesystem Hierarchy Standard, FilesystemHierarchyStandard, File types In Linux/Unix explained in detail, File Naming Conventions in Linux
Author Dong Chen
LastMod Mon Feb 4 2019