🎓 A1Learner
🔍
0 of 50 lessons completed

Shell Reading Permissions

Reading permissions means reading the long listing of a file. The long listing shows who may read, write and run a file, and who owns it.

List one file in long form

The first letter - means notes.txt is a file. The third column names the owner, the person who made the file.

ls -l notes.txt

List a second file

shopping.txt is also a file, with the same owner.

ls -l shopping.txt

List a file in a folder

Give ls -l a path, and it lists the file in that folder.

ls -l docs/readme.txt

List several files at once

ls -l lists each file you name, in order.

ls -l data.csv notes.txt shopping.txt

Example

ls -l notes.txt
ls -l data.csv
ls -l shopping.txt

Key points

  • ls -l: a command that lists files in a long form, with details.
  • The first column shows the type and the permissions, as a row of letters.
  • The first letter is d for a folder and - for a file.
  • These letters r, w and x mean read, write and run.
  • The owner column shows the user name of the file owner, and the group column shows the group name.

In this example, ls -l lists three files in long form. Each row starts with - for a file, then the permission letters. Next come the owner name, root on this machine, and the group name. Then the size in bytes and the date follow.

Note

the owner name on your screen is your own user name. It may differ from the name in this lesson.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

In ls -l, what do the letters r, w and x mean?