ls -l
and chmod
When we type ls -l
we get strings that correspond to the octal numbers used in chmod commands. For example:
This output in ls -l | could be set with this chmod command: |
-rw-r--r-- | chmod 644 filename |
drwxr-xr-x | chmod 755 dirname |
-rw------- | chmod 600 filename |
The meanings are:
octal digit |
rwx format |
meaning |
0 |
--- |
no permission |
1 |
--x |
execute |
2 |
-w- |
write |
3 |
-wx |
write and execute |
4 |
r-- |
read only |
5 |
r-x |
read and execute |
6 |
rw- |
read and write |
7 |
rwx |
read write and execute |
The three digits in an octal number have different meanings depending on their positions (text borrowed from Wikipedia).
The web page below gives you an opportunity to practice with converting between the format used in ls -l output, and the octal numbers used in chmod.
We will ignore the first character in the output (which is a - for regular files, and a d for directories).
Each time you click the "make new quiz" button, you'll get a different randomly generated quiz.