Menu
CoddyTech

Reading Permissions

Part of the Fundamentals section of Coddy's Terminal journey. Lesson 54 of 82.

Every line of ls -l starts with a 10-character permission string, for example:

-rw-r--r-- 1 user user  120 Jan 10 09:00 report.txt
drwxr-xr-x 2 user user 4096 Jan 10 09:00 projects

The first character is the type: - for a regular file, d for a directory. The other nine are three groups of three:

  • characters 2-4: the owner's permissions
  • characters 5-7: the group's permissions
  • characters 8-10: everyone else's (others)

In each group r means read, w write and x execute, and - means that permission is missing.

So rw-r--r-- lets the owner read and write, and everyone else only read. On a directory, x is what lets you enter it with cd.

challenge icon

Challenge

Easy

Use ls -l to display the detailed file listing and examine the permission strings for each item.

Look at the output and identify the permissions for each file and directory. For each item, read the 10-character permission string and determine:

  • Whether it's a file (-) or directory (d)
  • What permissions the owner has (first group of three)
  • What permissions the group has (second group of three)
  • What permissions others have (third group of three)

Run the command:

ls -l

In the output, notice how backup.sh, report.txt, and config.cfg are regular files without execute permission (x). Compare these to the projects directory, which starts with d instead of - and includes execute permission, allowing users to enter the directory.

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals

Practice on your own: Terminal playground