NAME
LS - Lists and generates statistics for files.
SYNTAX
ls [-aAbcCdfFgilLmnopPqrRstux1] [file ... | directory ...]
ARGUMENTS
-a Lists all entries in the directory, including the
entries that begin with a . (dot). Entries that
begin with a . (dot) are not displayed unless 1)
they are explicitly referenced, or 2) the -a flag
is specified.
-A Lists all entries, except . (dot) and .. (dot
dot).
-b Displays nonprintable characters in octal nota-
tion.
-c Uses the time of last modification (file created,
mode changed, and so on) for sorting (when used
with -t) or for displaying (when used with -l).
This flag has no effect when not used with either
-t or -l or both.
-C Sorts output vertically in a multicolumn format.
This is the default when output is to a terminal.
-d Displays only the information for the directory
that is named, rather than for its contents. This
is useful with the -l flag to get the status of a
directory.
-f Lists the name in each slot for each named direc-
tory. This flag turns off -l, -t, -s, and -r, and
turns on -a; this flag uses the order in which
entries appear in the directory.
-F Puts a / (slash) after each filename if the file
is a directory, an * (asterisk) after each
filename if the file can be executed, an = (equal
sign) after each filename if the file is a socket,
an @ (at sign) for a symbolic link, and a | (vert-
ical bar) for a FIFO.
-g Displays the same information as -l, except for
the owner.
-i Displays the i-number in the first column of the
report for each file.
-l Displays the mode, number of links, owner, group,
size, time of last modification for each file, and
pathname. If the file is a special file, the size
field contains the device's node number and the
major and minor device numbers. If the file is a
symbolic link, the pathname of the linked-to file
is also printed preceded by ->. The attributes of
the symbolic link are displayed. The -n flag over-
rides the -l flag.
-L Lists the file or directory the link references
rather than the link itself, if the argument is a
symbolic link.
-m Uses stream output format (a comma-separated
series).
-n Displays the same information as -l, except that
it displays the user and the group IDs instead of
the usernames and group names.
-o Displays the same information as with -l, except
for the group. The -n flag overrides the -o flag.
-p Puts a slash after each filename if that file is a
directory.
-P Displays the stripe attributes for a PFS file. The
stripe attributes displayed consist of:
o The file's stripe unit size, in bytes. This is
the unit of data interleaving used in the PFS
file.
o The file's stripe factor. This is the size of
the PFS file's stripe group. The stripe factor
is equal to the number of stripe directories,
and when multiplied by the stripe unit equals
the size of one PFS file stripe.
o The file's stripe group. The stripe group is a
list of stripe directories in the UFS or NFS
file systems (typically UFS mount points) that
are the storage locations for the PFS file.
The stripe attributes of an individual PFS file
can also be retrieved and set programmatically
with the fcntl() system call. See the fcntl(2)
manual page for more information.
-q Displays nonprintable characters in filenames as a
? (question mark) character, if output is to a
terminal (default).
-r Reverses the order of the sort, giving reverse
collation or the oldest first, as appropriate.
-R Lists all subdirectories recursively.
-s Gives space used in 512-byte units (including
indirect blocks) for each entry.
-t Sorts by time of last modification (latest first)
instead of by name.
-u Uses the time of the last access instead of time
of the last modification for sorting (when used
with -t) or for displaying (when used with -l).
This flag has no effect when not used with either
-t or -l or both.
-x Sorts output horizontally in a multicolumn format.
-1 Forces one entry per line output format; this is
the default when output is not directed to a ter-
minal.
DESCRIPTION
The ls command writes to standard output the contents of
each specified directory or the name of each specified file,
along with any other information you ask for with flags. If
you do not specify a file or a directory, ls displays the
contents of the current directory.
By default, ls displays all information in collated order by
filename. The collating sequence is determined by the
LC_COLLATE environment variable (see the ctab command).
There are three main ways to format the output:
1. List entries in multiple columns by specifying either
the -C or -x flags. -C is the default format, when out-
put is to a terminal.
2. List one entry per line.
3. List entries in a comma-separated series by specifying
the -m flag.
The ls command uses ioctl() to determine the number of byte
positions in the output line. If ls cannot get this informa-
tion, it uses a default value of 80. Note that columns may
not be smaller than 20 bytes or larger than 400 bytes.
MODES
The mode displayed with the -l flag is interpreted by the
first character, as follows:
b Block special file
c Character special file
d Directory
l Symbolic link
p First-In-First-Out (FIFO) special file
s Local socket
- Ordinary file
PERMISSIONS
The next nine characters are divided into three sets of
three characters each. The first three characters show the
owner's permission. The next set of three characters show
the permission of the other users in the group. The last set
of three characters show the permission of everyone else.
The three characters in each set show read, write and exe-
cute permission of the file. Execute permission of a direc-
tory lets you search a directory for a specified file.
Permissions are indicated as follows:
r Read
w Write
x Execute or search (directories)
- No access
The group-execute permission character is s if the file has
set-group-ID mode. The user-execute permission character is
s if the file has set-user-ID mode. The last character of
the mode (normally x or -) is t if the 01000 (octal) bit of
the mode is set; see the chmod command for the meaning of
this mode. The indications of set-ID and the 01000 bit of
the mode are capitalized (S and T, respectively) if the
corresponding execute permission is not set.
When the sizes of the files in a directory are listed, the
ls command displays a total count in 512-byte units, includ-
ing indirect blocks.
The LC_TIME environment variable controls the format of the
date and time.
EXAMPLES
1. To list all files in the current directory, enter:
ls -a
This lists all files, including . (dot), .. (dot dot),
and other files with names beginning with a dot.
2. To display information about the special file rz0a in
the /dev/io directories, enter:
ls -l /dev/io*/rz0a
brw-r--r-- 1 root system 3: 3, 0 Jun 05 09:08 io0/rz0a
brw------- 1 root system 7: 3, 0 Jun 08 07:29 io1/rz0a
brw------- 1 root system 11: 3, 0 Jun 08 07:29 io2/rz0a
brw------- 1 root system 15: 3, 0 Jun 08 07:29 io3/rz0a
3. To display file striping information about a PFS file
named ls_sa, enter:
ls -P /pfs/ls_sa
sunit 524288 sfactor 4 sdirs /home/.sdirs/vol3 /pfs/ls_sa
/home/.sdirs/vol0
/home/.sdirs/vol1
/home/.sdirs/vol2
This displays the stripe unit size (sunit), the stripe
factor (sfactor), and the stripe group (sdirs)..
4. To display detailed information, enter:
ls -l chap1 .profile
This displays a long listing with detailed information
about the files chap1 and .profile.
5. To display detailed information about a directory,
enter:
ls -d -l . manual manual/chap1
This displays a long listing for the directories . and
manual, and for the file manual/chap1. Without the -d
flag, this command lists the files in . and manual
instead of providing detailed information about the
directories themselves.
6. To list the files in the current directory in order of
modification time, enter:
ls -l -t
This displays a long listing of the files that were
modified most recently, followed by the older files.
FILES
/etc/passwd
Contains user information.
/etc/group
Contains group information.
LIMITATIONS AND WORKAROUNDS
For information about limitations and workarounds, see the
release notes files in /usr/share/release_notes.
SEE ALSO
OSF/1 Command Reference: chmod(1), find(1), ln(1), stty(1),
ioctl(2)
OSF/1 Programmer's Reference: ioctl(2)
calls: fcntl(2)
``Using Internationalization Features'' in the OSF/1 User's
Guide
Acknowledgement and Disclaimer