Understanding the Linux File System and File Permissions

Home » Cloud Computing » Understanding the Linux File System and File Permissions

The Linux file system is a well-organized and fine-grained file system through which you can securely store, organize, and retrieve files and directories through its well-defined permission system. Most of the cloud-native virtual machines are Linux based, so it is super important for you to understand the Linux file system and its permissions. Today, we will discuss the Linux file system in detail. We will go through the Linux folder structure along with the permission system to modify the access on files and folders. After going through this article, you’ll be equipped with the practical knowledge and insights necessary to apply these concepts to your professional projects, setting you on the path to success in your cloud career.

Section 1: The Linux File System

The Root Directory

Linux’s root directory, “/,” is where all other folders and files start. Linux file and directory organization begin here. The base directory keeps the file system organized.

The following are some important concepts associated with the root:

FHS: The File System Hierarchy Standard (FHS) organizes the main directory and its subdirectories. The FHS ensures compatibility and consistency across Linux distributions, making it easier for users, developers, and administrators to handle the file system. One example is /usr directory. According to FHS, the /usr directory should store shareable, read-only data, such as user utilities, applications, and documentation.

Permissions and Ownership: System security and access control depend on preset permissions and ownership options for the root directory and its contents. Root users can change any system file or location. This access may lead to data loss or illegal changes. Default permissions for the root directory (‘/’) are typically set to 0755 (drwxr-xr-x), allowing the owner (root) to read, write, and execute, while other users can read and execute but not write. The ‘sudo’ command temporarily allows authorized users to execute commands with root privileges, reducing the risk of accidental or malicious system modifications.

Mount Points: Linux mount points link hard drives and network shares to the file system. The root location holds the system’s main file system’s mount point and other mount points. Mount points help manage storage and network resources. If you have a new hard drive formatted with the ext4 file system, you could create a mount point directory ‘/mnt/new_drive‘ and then mount the drive with the command sudo mount /dev/sdb1 /mnt/new_drive.

Navigation: Working with Linux requires knowledge of the base directory and its subdirectories. Using command-line tools like cd, ls, and pwd is an effective way to navigate the root directory. The command ‘cd /‘ navigates to the root directory while the command ‘ls /home lists the contents of the /home directory.

Directories and Subdirectories

The top-level directory in the Linux file system is called the root directory (“/”) and contains several significant folders and subdirectories. To keep the file system organized and functional, each directory has a particular function. Under the root directory, you’ll find these important folders and subdirectories:

/bin: Essential system binary executables are kept in the /bin directory and are used by both the system and individuals. A few examples are “ls,” “cp,” and “mv.”

/dev: Device files that reflect hardware devices and fictitious devices are stored in the /dev directory and can be accessed just like regular files. For instance, “dev/sda” (first hard drive) and “dev/tty” (terminal device).

/etc: Scripts and setup files for the entire system are kept in /etc. Passwd (user account information), fstab (file system mount points), and ssh/sshd_config are a few examples (SSH server configuration).

/home: Contains user home directories, which house each user’s unique files, preferences, and configurations. The personal directory for the user “username” is, for instance, “/home/username”.

/mnt: For directly mounting file systems, such as those on external hard drives or network shares, /mnt acts as a temporary mount point. For an installed network share, use the example “/mnt/network_share”.

/root: The root user’s personal files and account settings are located in the directory /root.

/sbin: This directory houses system binary executables that are mainly used for system administration and maintenance. Examples include “ifconfig” and “fdisk” (disk segmentation). (network interface configuration).

File Naming Conventions

In the Linux file system, adhering to naming conventions for files and folders is essential for maintaining organization, avoiding conflicts, and ensuring compatibility across different systems and applications. Here are some important concepts for naming files and folders:

Case Sensitivity: Linux file systems are case-sensitive. Avoid issues by using uppercase and lowercase symbols consistently.

Example: Two files named “Report.doc” and “report.doc” in the same directory are separate.

Letters: Use alphanumeric letters (A-Z, a-z, 0-9), hyphens, underscores, and periods in file and folder names. Spaces, asterisks, question marks, and exclamation marks can cause problems or require extra handling (e.g., escaping, quoting) when using command-line tools or scripts.

Example: Use ‘Sales_Report_Q1_2023.xlsx’ or ‘Sales-Report-Q1-2023.xlsx’ instead of ‘Sales Report Q1 2023’.

Extensions: While not required, file extensions help users and applications detect file types and formats.

Example: Name a text file “notes.txt” or a Python script “script.py” to suggest format.

Hidden Files and Folders: Linux hides files and folders starting with a period (.) when showing directory contents. Use this approach for configuration, cache, and other hidden files.

Example: ‘.bashrc’ is a hidden Bash shell configuration file, and ‘.cache’ is a program cache folder.

Avoid Confusing Names: Avoid names that clash with system commands, binaries, or reserved words. This simplifies file management.

Example: Don’t name a file ‘cd’ or ‘rm’.

Descriptive Names: Name files and folders to show their purpose or content. This organizes files and helps users comprehend them without opening them.

Example: Instead of “data,” name a folder “Sales_Data_2023.

Section 2: Understanding File Permissions

Linux file permissions govern user access to files and folders. Permissions control who can view, write, and execute files and directories, ensuring security. Permissions are assigned to three categories of users: owner, group, and others (sometimes called world).

File Permission Types

File permissions are represented using a combination of letters and symbols:

Read (r): Grants permission to read the contents of a file or list the contents of a directory.

Write (w): Grants permission to modify a file or create, delete, and rename files within a directory.

Execute (x): Grants permission to execute a file (if it is a program or script) or access and traverse a directory.

Each permission category (owner, group, and others) has its own set of read, write, and execute permissions. For example, a file’s permissions might be represented as:


In this case, the first character indicates the file type (- for a regular file, d for a directory). The remaining nine characters are divided into three groups, each representing the permissions for the owner, group, and others, respectively. In this example:

Owner (user) has read (r), write (w), and execute (x) permissions: rwx

Group has read (r) and execute (x) permissions, but not write permission: r-x

Others have read (r) permission only: r–

Understanding Octal Notation

Linux file permissions can also be represented numerically using octal notation. Each permission type is assigned a number:

Read (r) = 4

Write (w) = 2

Execute (x) = 1

The octal value of a permission set is the sum of its permission values. For example, rwx (read, write, and execute) would be 4 + 2 + 1 = 7. The full set of permissions for owner, group, and others can be represented as a three-digit octal number, such as 755, which corresponds to -rwxr-xr-x.

Changing File Permissions

chmod is a Linux command used to modify file and directory permissions. The command allows you to modify the proprietor, group, and others’ read (r), write (w), and execute (x) permissions. There are two primary ways to specify permissions using chmod: symbolic mode and numeric (octal) mode.

Symbolic mode: In symbolic mode, you represent the user category and the permissions you wish to modify with letters and symbols. The format of the command is below:

chmod [who][operator][permissions] file

For instance, to add execute permissions for the owner and group to the script.sh file, you would execute: chmod u+x,g+x script.sh.

Octal mode: In octal mode, the permissions for each user category are represented by octal numerals. The fundamental format of the command is chmod [mode] file where mode is a three-digit octal number representing permissions for the proprietor, group, and others, respectively.

For instance, to set file.txt’s permissions to -rw-r–r– (owner: read and write, group: read, others: read), you would execute: chmod 644 file.txt.

In this instance, the octal number 644 represents the following permissions:

Ownership: 6 (4 + 2) equals read and write (w)

Group: 4 equals read (r)

Various: 4 = view (r)


Linux file system is a powerful and flexible structure that supports the core functionality of Linux-based systems. The root directory at the top and well-defined subdirectories for specific reasons make file management and navigation efficient. The Linux file permission system’s fine-grained access control ensures system security and safety. Linux users must understand these concepts, from directory layout to chmod permission management. Sound knowledge of the Linux file system and permissions is crucial for every IT professional.

Ready to Take Your Tech Career to the Next Level?

At Digital Cloud Training, we’re dedicated to your success. Our courses offer up-to-date content, equipping you with the expertise to stand out in the competitive tech job market.

Our On-Demand Training allows you to learn at your own pace, fitting seamlessly into your schedule. Dive into the world of cloud computing whenever and wherever suits you best.

But we don’t stop at theory. Our Challenge Labs provide practical, real-world scenarios where you can apply your newfound knowledge without the risk of unexpected cloud costs. Gain hands-on experience and sharpen your skills.

For those seeking an immersive experience, our Cloud Mastery Bootcamp delivers live, job-ready training. Led by industry experts, this accelerated program can get you certified faster than you thought possible.

It’s time to propel your tech career forward. Join us at Digital Cloud Training and unlock your full potential in the world of cloud computing.

Related posts:


Your email address will not be published. Required fields are marked *