Read Long-Listing Permissions
Read Long-Listing Permissions
The teacher sees a report in a directory but wants to know who can read or change it. ls -l includes a compact mode field near the start of the listing. At first it looks like a string of unrelated letters; once you split it into parts, it becomes much easier to read.
The first character describes the entry type. The next nine positions form three triplets for owner, group and others. We will read the ordinary bits first, then recognize that ACLs and other system rules can add information beyond this short display.
What you’ll learn
- Read the type and owner, group and others triplets in ls output.
- Interpret the displayed bits without assuming they describe every access constraint.
The mode string describes three access classes
Owner
The first ordinary triplet describes the owning user.
rw-Group
The next triplet describes the applicable group class.
r--Others
The final triplet describes users outside those classes.
---
Read the marks file’s permission triplets
Prepare the example
Use a new practice directory. The first line creates a small report, and chmod gives it a known ordinary mode for the reading exercise. That preparation avoids relying on whatever default mode your environment happened to choose.
Bash · Linux terminal
printf 'Diya: 72\n' > marks.txt
chmod 640 marks.txt
ls -l marks.txtExpected behavior; machine-dependent details
The mode begins -rw-r-----; owner, group, size and dates vary.After chmod 640 marks.txt, ls -l marks.txt should show the ordinary mode as -rw-r-----. The leading - indicates a regular file. Owner rw- allows read and write, group r-- allows read, and others --- grants no ordinary permission bits. A dash in a triplet means that bit is absent.
Read the owning user and group fields alongside the triplets, because they identify the classes. Names, sizes and dates vary across systems. If an extended ACL exists, the group-class display can reflect its mask; use getfacl for the additional entries. The listing is a useful starting point, not a complete guarantee about every possible access constraint.
Read type, identities and ordinary permission triplets
ls -l shows more than filenames. Its long format includes the file type, permission bits, link count, owner, group, size and modification time.
Step 1: Open your terminal
You can use any terminal. If you're using a Mac or Linux machine, just open the Terminal app. On Windows, use WSL or any Linux shell.
Step 2: Use the ls -l command
Let’s look at the contents of your current directory in long listing format:
ls -l
You’ll see an output that looks like this:
-rw-r--r-- 1 user user 1024 Jul 2 10:00 notes.txt
drwxr-xr-x 2 user user 4096 Jul 1 09:30 documents
-rwxr-xr-- 1 user user 2048 Jul 1 14:15 script.sh
Step 3: Understand the output
Let’s break down the line for script.sh:
-rwxr-xr-- 1 user user 2048 Jul 1 14:15 script.sh
- -: This indicates it's a file (d for directory)
- rwx: The owner (user) has read (r), write (w), and execute (x) permissions
- r-x: The group has read and execute permissions
- r--: Others (everyone else) only have read permission
The permissions are grouped like this:
- First character: File type (- for file, d for directory)
- Next 3 characters: User permissions
- Next 3 characters: Group permissions
- Last 3 characters: Others (world) permissions
Practice reading permissions on a test file
Create a file and check its permissions:
touch test.txt
ls -l test.txt
-rw-r--r-- 1 user user 0 Jul 2 11:00 test.txt
This tells us that the user can read and write the file, while the group and others can only read it.
Step 5: View permissions of all files and folders
You can also view permissions recursively inside subdirectories:
ls -lR
This is useful if you want to audit the entire structure.
Read an ls -l permission string from left to right
File permissions in Linux control who can do what with a file or folder. Use ls -l to view them. Each permission set is shown as a series of characters, grouped by owner, group, and others.
Understanding permissions is the first step to becoming confident in managing your Linux system securely and effectively.
Try it, then check the worked answer
Your task: Interpret the group triplet r--.
Use a new practice directory. The first line creates a small report, and chmod gives it a known ordinary mode for the reading exercise. That preparation avoids relying on whatever default mode your environment happened to choose.
Bash · complete example for this question
printf 'Diya: 72\n' > marks.txt
chmod 640 marks.txt
ls -l marks.txtExpected behavior; machine-dependent details
The mode begins -rw-r-----; owner, group, size and dates vary.Worked answer
Group read is allowed by these bits.
The group triplet r-- includes read, not write or execute. It does not say that every user can read. Identify which class applies to the reader and keep directory traversal or other access controls in mind when predicting a real operation.
Check your decision
Read the owner, group and others fields in order
Split the mode field instead of memorizing its whole string: type, owner, group, others. Read the names that define those classes and recognize missing bits. When a short listing does not explain access, inspect ACLs and the relevant directory path rather than assuming the display is wrong.
Reaching the recap and completing the quizzes are separate milestones.