Linux / UNIX – Display the permissions of a file

Q. How do I list or display the permission of a file using ssh? I don’t have GUI installed on a remote Linux computer.

A.You need to use ls command with -l option. File access permissions are displayed in the first column of the output, after the character for file type.

ls command List information about the FILEs. If no argument is given it will use the current directory by default.

Task: List a file’s access permissions

Type ls -l command as follows to display permission for /etc/passwd file:
$ ls -l /etc/passwd

-rw-r--r-- 1 root root 2453 Jul 17 16:25 /etc/passwd

Understanding the file permission

File access permissions appear in the first column of the output i.e. -rw-r–r–

  • The first character – is nothing but the file type. – means regular file and d means directory.
  • The next three characters (rw-) specify permissions for the user who owns the file
  • The next three (r–) specify permissions for all members of the group that owns the file.
  • Finally, the last three characters in the column (r–) specify permissions for all other users on the system.

Each character in permission has meaning as follows:

  • r : Read permission.
  • w : Write permission.
  • x : Execute permission.
  • : No permission.

For example rw- permission means owner can read, write to a file but cannot execute the same.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 11 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
11 comments… add one
  • PS Feb 27, 2013 @ 19:28

    Is there any way to list for what users those permissions apply?
    Like the “Permissions” display box in Windows?
    What I would like to know is:
    user John has read + execute permissions
    user Annie has only read permissions
    Group Developpers has read/write/exec permission


    Any way to do that?

    • bynw Jul 6, 2013 @ 19:20

      That’s not really necessary to be broken down. Again using the example above it’s easy to see who has what permissions.
      -rw-r–r– 1 root root 2453 Jul 17 16:25 /etc/passwd

      In the example, the owner of the file is root and the group is root.
      The owner has read+write permissions
      The group of root has read only
      And then everyone else has read only.

      So as long as you know what user and group owns a file and who that owner is and who is in that group (which is easy to look up) then you know everyone’s permissions.

      • PS Jul 10, 2013 @ 15:16

        Thanks, and it does make this clear.
        What I was looking for is something that the Unix permissions do not even provide – I was thinking I can assign rights to many different users, but this is not possible at all.
        In Windows, I can, for a single file, assign 20 users various rights. The standard Unix permission have a single owner, a single group and “everybody else”.

  • edwin Aug 14, 2013 @ 16:47

    please give me some step to find this FILE PERMISSION. where can i found them?

    • vamsi Oct 24, 2013 @ 10:46

      ls -l filename

  • Paul Nov 23, 2014 @ 4:46

    Sorry to add another question on your post man, but when i type

    ls -1 it list just file names. not permissions. like this

    ls -1

    shows no permissions. any suggestions?

    • Chan Dec 12, 2014 @ 0:04

      it is letter “L” not a number “1” paul…

  • adam Apr 24, 2015 @ 3:14

    You give the example
    -rw-r–r– 1 root root 2453 Jul 17 16:25 /etc/passwd
    What does the number 2453 mean?

    • anonimus May 13, 2015 @ 14:29

      The number is the filesize in bytes.

  • anonymous geek Oct 14, 2015 @ 14:53

    what does the date and the time indicate?

  • gandster Nov 16, 2015 @ 13:57

    I would like to know what that means as well ^^

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum