i wanted to know the Read / Write Access on to a file , so i did this way

ls -l Denem.sh

This command displayed

-rwxr-xr-x  1 pavan employee 672 DEC 20  2000 pavan.sh

Could anybody please tell me what -rwxr-xr-x indicates ??
From Wikipedia.com i found that -rwxr-xr-x indicates

for a regular file whose user class has full permissions and whose group and others classes have only the read and execute permissions.

Now my question is Should we take the middle thing (-xr-) into considiration ??

  • 6
    RTFM: man 1 ls
    – larsmans
    Commented Sep 14, 2011 at 11:24
  • 2
    Be gentle, @larsmans. The OP is clearly a complete Unix newbie. Don't scare him/her away.
    – Tom Zych
    Commented Sep 14, 2011 at 11:27
  • Sorry, but this was the second question by the OP about this very same topic on SO today.
    – Fred Foo
    Commented Sep 14, 2011 at 11:30
  • Ah, well, in that case, you may fire when ready :)
    – Tom Zych
    Commented Sep 14, 2011 at 11:32
  • This seems to me like a question which is mostly about WHAT file permissions are and HOW they work. That's why my answer was so long :)
    – nopcorn
    Commented Sep 14, 2011 at 16:05

2 Answers 2


This string:


Is separated into four sections:

-    indicates what kind of file it is
rwx  (first 3) owner permissions
r-x  (second 3) group permissions
r-x  (last 3) other permissions

All together, this string is supposed to provide (at a glance) the most important aspects of a file. Namely what it is and who can do what with it.

First Section

The first character in the string is reserved for the file type. Any regular old file will simply have a - in this position. Other include:

d directory
p pipe/fifo
l link
c character device file
b block device file
s local domain socket

So a pipe might look like this:

prwx------ root root filename

Second - Third - Fourth Section

The next 9 bits describe the permissions that everyone has when it comes to this file. There are three types of permissions:

r read (opening the file for reading, can't save changes)
w write (change the contents of file)
x execute (run the file, like a script or binary)

And there are three groups to which these permissions may be applied to:

owner whoever owns the file (as seen by the output of ls -l)
group whoever is part of the group owner of this file
others anyone who doesn't fall in either of the two above categories

For example:

-rwxr-xr-x  1 pavan employee 672 DEC 20  2000 pavan.sh
pavan is the owner
employee is the group owner name
anyone else falls into "others"

Referring to the above example, if we want to make pavan have full control over the file, let anyone in the employee group to read or execute the file and block all permissions to others:


The numbers

The reason permissions are sometimes represented with numbers is that it is generally easier to use an octal representation of the 9 bits (I still prefer straight up rwx).

To understand what the numbers mean you need to build a table (if you've ever done work with binary this will help):

#  r  w  x
0  0  0  0
1  0  0  1
2  0  1  0
3  0  1  1
4  1  0  0
5  1  0  1
6  1  1  0
7  1  1  1

You refer to this chart for each set of three bits. For example, if I decide to give the owner of the file complete control (r,w and x), only read for the group and also only read for others:

rwx owner corresponds to 7 in the table
r-- group corresponds to 4 in the table
r-- other corresponds to 4 in the table
Therefore my file has permissions 744
  • 1
    But just because a file has 'r' permissions for a user doesn't mean they can read it - they also need to r+x on a directory it is in. The rute (linux.2038bug.com/rute-home.html) is an excellent, free, online introduction to Unix (inlcuding file permissions)
    – symcbean
    Commented Sep 16, 2011 at 12:22

Divide it up like this:

- rwx r-x r-x

It's owner, group, others. So the owner (pavan) can read, write, and execute; people in the group employee can read and execute, but not write; anyone else can also read and execute but not write.

The - in front would be d for a directory, l for a symbolic link, etc. man ls.

You must log in to answer this question.