Typorithm · medium

Permissions & chmod

bash-permissionsbashchmodpermissionschown
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn Permissions & chmod

0%

System

ls -l shows the rwx triplet for user/group/other; chmod +x adds the execute bit; octal sets all bits at once — 644 is rw-r--r--, 755 is rwxr-xr-x; chown changes owner:group; and umask masks the default permissions of new files.

Every file carries read, write, and execute bits for three classes: the owning user, the group, and everyone else. ls -l prints them as a triplet like rwxr-xr-x, and you read it left to right as user, group, other.

chmod changes those bits. Symbolic form like +x adds the execute bit; octal form sets all of them at once, where each digit is a sum of read (4), write (2), and execute (1) — so 644 is rw-r--r-- and 755 is rwxr-xr-x.

chown changes ownership, taking an owner:group pair. umask sets the default permission mask for newly created files — 022 clears the group and other write bits, so new files start without world-writable access.

01

ls -l shows rwx for user, group, and other.

02

chmod +x adds execute; octal 644 is rw-r--r--, 755 is rwxr-xr-x.

03

chown sets owner:group; umask masks new-file defaults.

ls -l script.sh
chmod +x script.sh
chmod 644 file.txt
chown user:group file.txt
umask 022

Read the implementation

Connect each part of the code to the concept before you type.

1. Show permissions

ls -l prints the rwx permission triplets for user, group, and other.

ls -l script.sh

2. Add execute bit

chmod +x adds the execute bit so the file can be run as a program.

chmod +x script.sh

3. Set octal mode

644 sets all bits at once: rw-r--r-- (owner read/write, others read-only).

chmod 644 file.txt

4. Change owner

chown sets the file's owner to user and its group to group.

chown user:group file.txt

5. Default mask

umask 022 masks the default permissions of new files, clearing group/other write.

umask 022

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

Permissions & chmod: Lesson & Practice · Typorithm | ApplyDjinn