Use this online tool to convert the file permission for the owner, group and public to the numeric value and symbolic notation. You can use these converted notations to know or to change the file permission using chmod Linux command.
Do you want to learn how to calculate the file permission values? You should be familiar with the ownership, permission, notations and basic Linux commands. We will see them one-by-one. In the later part, I will describe you to calculate Linux file permission.
Let’s dive in.
Table of Contents
There are three types of ownership for each file in the Linux.
You can set the different file permissions for different types of ownership.
Each file or directory has three permissions or mode of accessing it.
For sake of simplicity and to calculate the numeric value for file permission, consider
r=4 (2^2) w=2 (2^1) x=2 (2^0) -=0
By adding them, you get the numeric value for file permission.
For example:
rwx = 4+2+1 = 7 r-x = 4+0+1 = 5
You can use symbolic as well as numeric mode for getting and setting file and directory permission in Linux.
Use ls
command:
ls -l <file_name>
If you don’t provide the file name, it list out all the files and directories in the current directory.
ls -l
Sample output for the ls
command:
You can see the symbolic notation with prefix ‘-‘ or ‘d’.
ls
and chmod
are two very useful Linux commands.
Use chmod
command:
chmod <numeric_mode> <file_name>
It is convenient to use numeric mode value for setting up the file permission.