2 Minutes To Code (β Version)

'chmod' command - 2 minute tutorial

Overview of 'chmod' command

The unix command chmod sets read, write and execute permissions for files and folders.

There are 3 types of permissions for a file i.e. read , write and execute pbbreviated as r, w and x respectively. This command also assigns numbers 4, 2 and 1 to read, write and execute permissions respectively. Now to set only read permission, you can call the chmod command on the file with an argument 4 which is the number assigned to read permission. To set the read and execute permissions you can use 5 (4+1) as an argument to chmod. Check the usega eof these number abbreviations in example 1 below.

Now, these 3 permissions can be separately set for three types of users, one is the owner of the file, next is users in the group to which the file belongs and the third category of users consists of all other users who are neither the owner nor belong to the group that owns the file. These three category of users are abbreviated as u, g and o and the letter a is used to represent all users. Check the usage of these abbreviations in example image 3 below.

You can have a look at the usage of 'chmod' and all its options in the next few pages.