| | | 5.4 ls -l output - format and content |
5.4 ls -l output - format and content
The ls -l
command is very common. Understanding
the output give some insight into the UNIX system. ls
is the UNIX version of the directory command. The -l
option
is for the long form of the output. An example of this command follows:
[44] red:/home/ltaber > ls -l tmp
-rw-r----- 1 ltaber wheel 1876 Jan 17 1996 tmp
Each field will be looked at in turn.
- Protection bits
-rw-r---
The first character, in this case a "-
" indicates what type of
a file it is. The "-
" indicates that it is a regular file,
simply a collection of bytes. The next nine "bits" are three
groups of three bits. The first group of three bits is for the user.
The middle three bits is for the group. The last three bits is for
all other users. In each group of three bits the first bit is for
read permission and is shown with an "r
".
The middle of the three bits is related to write permission and is shown
with a "w
". The last bit in the group is
related to execute permission and is shown with an "x
"
These bits can be displayed with different letters on occasion
depending on the value of other protection bits. These bits can
be changed by the chmod
command.
- File ownership
ltaber
This indicates who owns the file.
- File group.
wheel
This indicated which group owns the file. Users on most UNIX systems
can be associated with more than one group.
If a file is created by a user it is created under the users current group.
The command newgrp
can be used to change your current group.
The command id
can be used to show all groups
that you are a member of.
- File size, in bytes
1876
- File modification date
Jan 17 1996
or Mar 28 16:55
Unix stores three time stamps for each file. Internally it is stored
in seconds past a certain time. It is displayed in one of two formats.
It will display just the day and year for "old" files. It will display
just the day and time for "new" files. The boundary between old
and new files is six months.
- File name
tmp
This shows the name of the file after wild card matching.
Instructor: ltaber@pima.edu ** My new Home at GeoApps in Tucson ** The Pima College Site
| | | 5.4 ls -l output - format and content |