In this blog we will discuss about octal or numerical permissions with the files in Linux .Octal permission is a numerical representation of the file permission .First of all lets open our terminal , We can press ctrl+alt+ t to do this .
Now lets do a $ ls -l file_name
, so that we can see detailed information about the file.
![](http://www.codebind.com/wp-content/uploads/2022/02/Screenshot-from-2022-02-01-17-13-20-1024x576.png)
For details about the above information you can refer to blog :” File Permissions, Symbolic Permissions and chmod“
1.
![](http://www.codebind.com/wp-content/uploads/2022/02/Screenshot-from-2022-02-01-17-17-04.png)
This is just a normal text file and let’s say this is our users and groups and others (row 1 ) and each have its permissions read , write and execute (row 2) . In the third row , all permissions are denoted in binary number . In the the fourth row we have non binary representation , which is ( 4 2 1).Now the end row is giving summation of all these three numbers ( =7 ) .
if you want to allow the user to read write and execute a file then you need to give the number notation 7 and this is calculated as above .
if you want don’t want to give any of the permission then do 0 , in 3rd row that is in case of binary representation .
2.For group , we wont be giving write permission .It looks like :
![](http://www.codebind.com/wp-content/uploads/2022/02/Screenshot-from-2022-02-01-17-30-11.png)
So whenever you want to give the only read and execute permission then you just need to give the numerical notation of 5 .
3.For others , we wont be giving execute permission .It looks like :
![](http://www.codebind.com/wp-content/uploads/2022/02/Screenshot-from-2022-02-01-17-33-05.png)
So whenever you want to give the only read and write permission then you just need to give the numerical notation of 6.
4.There is a table for all these permissions . You can refer to that :
![](http://www.codebind.com/wp-content/uploads/2022/02/Screenshot-from-2022-02-01-17-34-54.png)
Form the table : if you want to give execute permission you give 1 , if you want to give write permission you give 2 and then write and execute is 3 , read is 4, read&execute is five , read&write is six and read&write&execute is 7.
5. Now for example I want to change the permission of test1.txt file using number notation then I can just do chmod and then I can give 0 for the user ,(0 means no permission ) for the user we are not providing anypermission for the group also for example we will provide no permission and for the others also we will provide no permission .
![](http://www.codebind.com/wp-content/uploads/2022/02/Screenshot-from-2022-02-01-17-41-16-1024x576.png)
Now nobody have any permission for this file now we want to allow the user to read&write&execute and for the group and others we just want to give the permission read&execute which is five so you can just do :
![](http://www.codebind.com/wp-content/uploads/2022/02/Screenshot-from-2022-02-01-17-45-34-1024x576.png)
So this is how you can use octal or numerical permissions in Linux .
Leave a Reply