8.3 Inspection

The ls (list) command is very flexible, and it can be used to examine the ownership and permissions of files. The long format of ls is particularly useful. To list files in the home folder using the long format, do the following:

ls -l ~

This is useful for most files. However, it does not display information about directories, or that of hidden files. To include hiddle files, do the following instead (include the -a option):

ls -al ~

To view permissions and ownerships of the home directory, use the following command (use the -d option):

ls -ld ~

A line of the long format looks like the following:

-rw-r--r--  1 tauyeung tauyeung      3925 2001-08-05 21:26 XF86Config

Let us explain the first part: -rw-r--r--. The first letter indicates several special attributes. A dash - means this is a regular file with no special attributes. The next three letters, rw- indicates permission for the owner. r means the file is readable, w means the file is writable, the last dash is a dash, which means the file is not executable.

The next three letters indicate permissions for group level access. r-- means the file is readable from the group. The last three letters indicate permissions for world level access.

The number 1 indicates the number of files contained in a directory. Since this is a regular file, the number is one.

The first tauyeung indicates owner-level ownership. The second tauyeung indicates group-level ownership. You can see that this particular file has no special group ownership. 3925 is the size of the file in number of bytes. The size is followed by date, time, and the name of the file.

To look at the the permissions and ownerships of the home directory, execute the following command:

ls -ld ~/

Copyright © 2006-07-31 by Tak Auyeung