Chmod 007🔫

Tharunravuri
2 min readMay 15, 2021

Have you ever wonder about the chmod command?

Well, everyone knows it is used for changing the permissions of the file. But why does this command named chmod instead of chper or chperm?

The answer is simple, permissions are also called modes in Linux. As the chmod command changes the permissions or modes of files. So they named it chmod.

Anyways, the naming is not the fascinating point here, but the logic behind this command is.

We all use chmod 777 knowingly or unknowingly in our daily life to change the permissions. But these digits 777 are responsible for enabling the permissions for the files.

Let's talk about the output of the ls -l command for a while.

ls -l output

The first column can be divided in to two categories:

  1. Type : The first category describes the type of the file. If the file is a directory it is represented with the symbol “ d ”. If the file is not a directory it can be leave as a blank space.

2. Access modes: Any file can be access by three set of users. All these three users can have read, write and execute permissions.

  • User : The owner of the file is known as user
  • Group : Each user can be in one or more groups. All the users in that group can have the same set of permissions for the file.
  • Others : Any other user apart from the group can also access the file if he have permissions.

All these permissions can be enabled for any user by enabling the binary values (0,1).

octal and binary values are responsible for enabling the permissions

So if we execute chmod 777 sample.txt, all the users like owner, group and other users have read, write and execute permissions for that sample.txt file.

Refer the below examples for more understanding.

That’s the working behind the chmod commands. Clap and share with your friends. Meet you on the next blog!! 💌

--

--