Q1What is the octal for the -rwxr-xr-x shown at the start of ls -l?
Permissions — Reading Them and chmod
Learn to read the rwx notation and octal numbers in ls -l, rewrite permissions with chmod's symbolic and numeric modes, and the syntax of chown — hands-on in a browser terminal.
Reading Permissions — ls -l and Octal
Permissions are a setting for who can do what to a file or directory.
When you run ls -l, each line starts with 10 characters like -rwxr-xr-x.
The first character is the type (- for a file, d for a directory), and you read the next 9 in groups of three.
The 9 characters are three groups from the left: owner, group, and other.
Each group is in the order r (read), w (write), x (execute) — a letter if allowed, or - if not.
r=4, w=2, x=1 correspond to three binary bits, and you add the 4, 2, 1 places.
Adding up one group, rwx is 7, r-x is 5, and r-- is 4; line up three groups and you get octal notation like 755 or 644.
| Symbol | Meaning | r4+w2+x1 | Number |
|---|---|---|---|
--- | Nothing allowed | 0 | 0 |
--x | Execute only | 1 | 1 |
r-- | Read only | 4 | 4 |
r-x | Read + execute | 4+1 | 5 |
rw- | Read + write | 4+2 | 6 |
rwx | Full access | 4+2+1 | 7 |
| Octal | rwx notation | Use |
|---|---|---|
644 | rw-r--r-- | Regular files |
755 | rwxr-xr-x | Scripts and directories |
700 | rwx------ | Private keys, personal directories |
600 | rw------- | Config files |
rwxr-xr-x reads as owner 7, group 5, other 5 — that is, 755.Permissions here vs. on a production server
This browser environment runs as root alone, so even if you change bits with chmod, root ignores access restrictions and Permission denied doesn't appear.
In this course you learn how to read the bits and the syntax of chmod / chown.
You can actually see the ls -l display change.
On a multi-user production server, these permission settings work as access control.
touch report.txt # create material
ls -l report.txt # read the leading rwx notation
ls -l # list the directory to see d too
Changing Permissions — chmod
chmod changes permissions.
There are two ways to write it: symbolic mode, where you specify with symbols like chmod +x file to 'add execute', and numeric mode, where you specify owner, group, and other together with a 3-digit octal number like chmod 644 file.
| Mode | How to write it | Example | Meaning |
|---|---|---|---|
| Symbolic | chmod [ugoa][+-=][rwx] | chmod +x file | Add execute |
| Numeric | chmod NNN file | chmod 644 file | Set all three groups at once |
+x adds execute, and the numbers 644 / 700 set all three groups at once.touch script.sh # create material
chmod +x script.sh # add execute
ls -l script.sh # check that x was added
Owner Only — chmod 700
chmod 700 gives the owner rwx and gives the group and other nothing.
It's the typical setting for things you don't want anyone but the owner to touch, like private keys or personal directories.
The display becomes rwx------.
Changing the Owner — chown
chown is the command that changes the owner of a file or directory.
The syntax is chown user file, and to change the group too you write chown user:group file.
Here the : separates the user and group: before the : is the owner, and after it is the group.
| How to write it | Meaning | Example |
|---|---|---|
chown user file | Change the owner | chown alice file.txt |
chown user:group file | Change the owner and group | chown alice:dev file.txt |
Changing the owner is inherently a root operation, used on multi-user servers to hand a file over to a new owner.
There's no occasion to run it in this environment, so just read and learn the shape of the syntax in the next example.
chown alice file.txt # change the owner to alice
chown alice:dev file.txt # owner alice, group dev
Knowledge Check
Answer each question one by one.
Q2What does chmod +x script.sh do?
Q3What is the notation after running chmod 700 secret.txt?