Tag: ls

Decoding the ls -l Output

ls has many options. One I use a lot is:

ls-l

This gives a long listing of files and folders. Here is a single line of an example output from ls -l:

drwxr-xr-x  2 dave dave   4096 2011-05-22 21:44 Shutter Caps/

The first character represents the File Type. In the example above the d indicates that this is a folder. The possible characters that could be used in this position, and their meanings, are as follows:

d = directory (folder)
– = regular file
l = symbolic link
s = Unix domain socket
p = named pipe
c = character device file
b = block device file

The next 9 characters represent the permissions for the file or folder.  There are three sets of 3 symbols, or triplets. The first triplet represents user permissions, the second triplet represents group permissions and the final triplet represents permissions for other (as in all other users).  The three characters in each triplet represent the read, write and execute permissions for that triplet.

r = read permission
w = write permission
x = execute permission
– = no permission

In this example, rwxr-xr-x indicates read-write-execute permission for user, read and execute (no write) permission for group, and execute only permission for others.

The rest of the line is made up of a number of fields.

Number of Links
In this example, 2 indicates there are two links to this folder.

Owner
In this example, this folder is owned by the user named dave.

Group
In this example, this folder belongs to the dave group.

Size
In this example, 4096 indicates the size. Note that this is not the same as the amount of data in the folder. It shows the size of the internal representation of a folder within the Ubuntu file system.

Time Stamp
The date and time of the last modification of the folder. In this example, 2011-05-22 21:44 indicates the folder (actually, its contents) was last modified at 9:45pm, on 22nd May, 2011.

Name
The name of the folder. In this example, the folder name is Shutter Caps. (This happens to be where I have Shutter store any screen captures I take.)

Tags : ,