This is the format

chmod [owner permission][group permission][other permission] [file name]

This is how these permissions are represented.
read = 4
write = 2
execute = 1

Altogether
owner = read | write = 6
group = read = 4
other = read = 4

Generally used permission levels : 

# Permission rwx
7 read, write and execute rwx
6 read and write rw-
5 read and execute r-x
4 read only r–
3 write and execute -wx
2 write only -w-
1 execute only –x
0 none

 

Examplarary modes :

rwx rwx rwx = 111 111 111
rw- rw- rw- = 110 110 110
rwx --- --- = 111 000 000

and so on…

rwx = 111 in binary = 7
rw- = 110 in binary = 6
r-x = 101 in binary = 5
r-- = 100 in binary = 4

So, the basic syntax of the command to set the mode is

chmod 644 [file name]

View the permission.

ls -l some_file

Reference :

Advertisements