Calculate chmod permissions for files and directories.
Owner (u) Group (g) Public (o)
Read (4)
Write (2)
Execute (1)
000
---------

Description

This tool helps you quickly calculate Linux file/directory permissions in both octal and symbolic forms (for example, 755 corresponds to rwxr-xr-x).
Permission bits
1. Read = 4, Write = 2, Execute = 1;
2. Each permission group (Owner / Group / Public) ranges from 0 to 7;
3. The value of each group is the sum of selected permissions, for example: Read + Execute = 4 + 1 = 5.
Common examples
755: Owner can read/write/execute, Group/Public can read/execute (commonly used for directories and executable files);
644: Owner can read/write, Group/Public are read-only (commonly used for regular text files);
600: Only Owner can read/write (commonly used for private configuration files).
chmod command usage
Set permission for a single file: chmod 644 file.txt
Set permission for a directory: chmod 755 mydir
Recursively set permissions for a directory and all children: chmod -R 755 mydir
Add execute permission with symbolic mode: chmod +x script.sh
Add write permission for Owner only: chmod u+w file.txt
How can one field represent multiple states?
1. Each value should follow the 2^n pattern (1, 2, 4, 8, 16, 32...);
2. To represent 2, the value is 2; to represent both 2 and 4, the value is 4+2 = 6;
Bitwise check: (value & target) = target, for example, (6&2) == 2, (6&4) == 4.