Understanding chmod: A beginner’s guide to Linux’s powerful file permission command

Understanding chmod: A beginner’s guide to Linux’s powerful file permission command

Linux is one of the most widely used operating systems in the world of technology. It has found its applications in multiple domains, including those that deal with large-scale data, web development, and artificial intelligence, among others. Understanding how Linux works and the powerful commands integrated within the system is crucial for anyone who aims to work in a Linux environment.

One of the most powerful commands available in Linux is chmod, an abbreviation for change mode. It is a command-line utility that allows the user to change the access permissions of files and directories. In this article, we will explore the working principles of chmod and how it could be used to manage file and directory permissions.

Modes and Permission Types

chmod works based on the mode and permission types that are assigned to files and directories. The mode is a combination of a specific set of permissions, and it could be represented using integers or symbols. The three primary modes in chmod for file/directory permissions are read, write, and execute. When given a digit, these modes are translated into binary numbers where read, write, and execute are assigned the values of 4, 2, and 1, respectively.

For example, when assigning permissions with chmod, the mode 644 will allow the owner to read and write and users in the same group to only read the file. The mode is represented using the following integers: 6 for read and write permissions for the owner, 4 for read-only permissions for the group, and 4 for read-only permissions for others.

On the other hand, permission types are file or directory related features that could be manipulated with chmod. Some commonly used permission types include owner, group, everyone, and sticky bits.

How to use chmod

chmod works with both symbol and octal modes. Symbolic modes have the owner, group, and other permission groups designated as ‘u’, ‘g’, and ‘o’ respectively. They also use the operators plus, minus, and equal to either add, remove, or set new permission modes.

For example, to add write permission to the owner of a file, the command would look like this:

chmod u+w filename.txt

The same could be done for a group permission using the ‘g’ operator:

chmod g+w filename.txt

To remove write permission from a file for a given user, the ‘-’ operator is used instead:

chmod u-w filename.txt

You can also use chmod with numerical modes. In this case, the permission types are expressed numerically, with four digits used for each file permission category. The first digit refers to special permissions such as suid, sgid, and sticky bit, the second digit is for owner permissions, the third is for the group, and the last one is for others. To use numerical modes with chmod, use a hyphen followed by a numerical mode like this:

chmod 644 filename.txt

This sets the read and write permission for the user, and only read permission for group and others.


As we have seen from the examples provided, chmod is one of the most fundamental commands of the Linux operating system. Understanding how to use it is essential in managing file and directory permissions in a secure and efficient manner. Linux has many useful commands, and it pays to take the time to learn them. With time and constant practice, controlling permissions using chmod and effectively managing your files and directories will become second nature.

Mastering chmod will allow you to navigate through the complexities of file and directory permissions with ease, thus helping you to take your Linux usage to the next level.