Back to course

34. Changing Permissions: Understanding Octal Notation (Numeric)

Linux Basics: From Zero to CLI Hero

Numerical Representation of Permissions

The chmod command (CHange MODe) is used to modify file and directory permissions. The simplest way to use chmod is via Octal (numeric) notation.

Each permission (r, w, x) is assigned a numeric value:

PermissionNumeric Value
r (Read)4
w (Write)2
x (Execute)1
- (No permission)0

Calculating the Octal Code

The total permission for each set (User, Group, Others) is the sum of its values. A standard permission code is a three-digit number.

PermissionsSumOctal Code
rwx (Read, Write, Execute)4 + 2 + 17
rw- (Read, Write)4 + 2 + 06
r-x (Read, Execute)4 + 0 + 15
r-- (Read only)4 + 0 + 04

Example: chmod 754

  • 7 (User): rwx
  • 5 (Group): r-x
  • 4 (Others): r--

bash

Gives the owner full access, the group read/execute, and others read only.

$ chmod 754 my_script.sh