Commit 51f3df
2026-08-05 22:24:08 Niklas Polke: Create CHMOD| /dev/null .. linux/chmod.md | |
| @@ 0,0 1,54 @@ | |
| + | # CHMOD |
| + | |
| + | The chmod command is used to change file and directory permissions in Linux and Unix-based systems. Permissions can be specified using either numeric (octal) or symbolic (letter) notation. |
| + | |
| + | ## Numeric (Octal) Notation |
| + | |
| + | Each permission is represented by a number: |
| + | ``` |
| + | 4 = Read (r) |
| + | 2 = Write (w) |
| + | 1 = Execute (x) |
| + | ``` |
| + | |
| + | The values are added together for each user category: |
| + | ``` |
| + | Owner |
| + | Group |
| + | Others |
| + | ``` |
| + | |
| + | Example: `chmod 755 script.sh` |
| + | |
| + | This results in: |
| + | ``` |
| + | Owner: rwx (7 = 4+2+1) |
| + | Group: r-x (5 = 4+1) |
| + | Others: r-x (5 = 4+1) |
| + | ``` |
| + | |
| + | ## Symbolic (Letter) Notation |
| + | |
| + | Permissions can also be modified using letters: |
| + | ``` |
| + | u = User (owner) |
| + | g = Group |
| + | o = Others |
| + | a = All users |
| + | ``` |
| + | |
| + | Operators: |
| + | ``` |
| + | + = Add permission |
| + | - = Remove permission |
| + | = = Set exact permission |
| + | ``` |
| + | |
| + | Examples: |
| + | ``` |
| + | chmod u+x script.sh # Add execute permission for the owner |
| + | chmod g-w file.txt # Remove write permission from the group |
| + | chmod a=r file.txt # Set read-only permission for everyone |
| + | ``` |
| + | |
| + | Both notations achieve the same result. Numeric notation is commonly used for setting complete permission sets, while symbolic notation is useful for modifying specific permissions. |
