Chmod Calculator for Linux File Permission
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.
There are three types of ownership for each file in the Linux.
- User– One who owns the file. By default, the user who creates the file becomes the owner of the file.
- Group– The owner can create the group and assign the file permission to the file. One can simply add any user to the group to access the file.
- Other– All the users apart from the owner and group members, become part of the other.
You can set the different file permissions for different types of ownership.
Each file or directory has three permissions or mode of accessing it.
- Read mode (r)– Read mode gives you permission to read the file.
- Write mode (w)– Write mode gives you permission to write and update the file.
- Execute mode (x)– Execute mode gives the ability to execute the file.
[Example] How to Calculate Linux File Permission?
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.
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.
How to get the file permission in Linux?
ls -l <file_name>
If you don’t provide the file name, it list out all the files and directories in the current directory.
Sample output for the
You can see the symbolic notation with prefix ‘-‘ or ‘d’.
- The prefix ‘-‘ in symbolic notation represents a file.
- The prefix ‘d’ in symbolic notation represents a directory.
chmod are two very useful Linux commands.
How to set the file permission using Linux chmod command?
chmod <numeric_mode> <file_name>
It is convenient to use numeric mode value for setting up the file permission.