How to View File Permissions in Linux

How to View File Permissions in Linux

Welcome to this Linux beginner tutorial. Today, we’ll learn how to view file permissions using the ls -l command. Permissions in Linux determine who can read, write, or execute a file — and they’re essential for system security and control.

Let’s get started!

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

Step 4: Try it yourself

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.

Summary

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.


Comments

💬 Please keep your comment relevant and respectful. Avoid spamming, offensive language, or posting promotional/backlink content.
All comments are subject to moderation before being published.


Loading comments...