ls(1)
_________________________________________________________________
ls Command
list contents of directory
_________________________________________________________________
SYNTAX
ls [ -abcdfgilmnopqrstuxCFLR ] [names]
DESCRIPTION
When no names are given, the current directory is listed. For
each directory name, ls lists the contents of the directory; for
each file name, ls repeats its name and any other information
requested.
The output is sorted alphabetically by default. When several
arguments are given, the arguments are first sorted
appropriately, but file arguments appear before directories and
their contents.
There are three major listing formats:
One entry per line (the default).
Multi-column, enabled by
the -C (sort down columns) and -x (sort across rows)
options.
Stream, enabled by
the -m option. Files are listed across the page,
separated by commas.
To determine column and stream output formats (for -C, -x, and
-m), ls uses an environment variable, COLUMNS, to determine the
number of character positions available on one output line. If
this variable is not set, the terminfo database is used to
determine the number of columns, based on the environment
variable TERM. If this information cannot be obtained, 80
columns are assumed.
Options are:
-a List all entries; usually entries whose names begin with a
period (.) are not listed.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
ls(1)
-b Print non-graphic characters in the octal \ddd notation.
-c Use time of last modification of the i-node (file created,
mode changed, etc.) for sorting (-t) or printing (-l).
-d If a name is a directory, list only its name (not its
contents); often used with -l to get the status of a
directory.
-f Interpret each name as a directory and list its files. This
option turns off -l, -t, -s, and -r and turns on -a.
-g The same as -l, but the owner is not printed.
-i Print the i-number of each entry in the first column of the
report.
-l List in long format, giving mode, number of links, owner,
group, size in bytes, and time of last modification for each
file (see below). For a special file, the size field will
contain the major and minor device numbers, not a size.
-m Stream output format; list names one after another,
separated by commas.
-n The same as -l, but the owner's UID and group's GID numbers
are printed, rather than the associated character strings.
-o The same as -l, but the group is not printed.
-p Put a slash (/) after each filename if that file is a
directory.
-q Print non-graphic characters in filenames as the character
(?).
-r Reverse the order of sort to get reverse alphabetic or
oldest first as appropriate.
-s Give size in blocks, including indirect blocks, for each
entry.
-t Sort by time modified (latest first) instead of by name.
-u Use time of last access instead of last modification for
sorting (with the -t option) or printing (with the -l
option).
-x Multi-column output with entries sorted across the page.
-C Multi-column output with entries sorted down the columns.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
ls(1)
-F Put a slash (/) after each filename if that file is a
directory, an asterisk (*) after each filename if that file
is executable, and an at sign (@) after each filename.
-L If the argument is a symbolic link, list the file or
directory that the link references rather than the link
itself. The effects of this option can only be seen when
this option is used in conjunction with long listing.
-R Recursively list subdirectories encountered.
The mode printed under the -l option consists of 10 characters
that are interpreted as follows.
The first character of the entry is:
d if the entry is a directory;
b if the entry is a block special file;
c if the entry is a character special file;
p if the entry is a fifo (a.k.a. named pipe) special
file;
- if the entry is an ordinary file;
l if the entry is a symbolic link.
The next 9 characters are interpreted as three sets of three
bits each. The first set refers to the owner's permissions;
the next to permissions of others in the user-group of the
file; and the last to all others. Within each set, the
three characters indicate permission to read, to write, and
to execute the file as a program, respectively. For a
directory, execute permission means permission to search the
directory for a specified file.
The permissions are indicated as follows:
r if the file is readable;
w if the file is writable;
x if the file is executable;
- if the indicated permission is not granted.
The group-execute permission character is given as s if the
file has set-group-ID mode; likewise, the user-execute
permission character is given as s if the file has set-
user-ID mode. The last character of the mode (normally x or
-) is t if the 1000 (octal) bit of the mode is on; see
chmod(1) for the meaning of this mode. The indications of
set-ID and 1000 bits 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, a total
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)
ls(1)
count of blocks, including indirect blocks, is printed.
_________________________________________________________________
EXAMPLES
$ ls -a
.
..
.profile
a.out
bigfile
main.c
subr.c
In the above example, all of the files contained in the current
working directory, including those beginning with "." are listed.
If the command were executed with no options, all files would be
listed except for the files beginning with ".". NOTE: The
single "." file represents the working directory, and the file
".." represents the parent directory.
$ ls -x
a.out bigfile main.c
subr.c
The above example allows the file listing to span several
columns.
$ ls -l
total 4
-rwxr-xr-x 1 user4 other 52345 Nov 18 16:16 a.out
-rw-rw-rw- 1 user4 other 4 Oct 13 9:56 bigfile
-rw-rw-rw- 1 user4 other 864 Sep 1 15:12 main.c
-rw-rw-rw- 1 user4 other 16 Nov 20 14:23 subr.c
The above example shows all of the information about all of the
files in the current working directory, except those files
beginning with ".".
_________________________________________________________________
FILES
/etc/passwd To get user IDs for ls -l and ls -o.
/etc/group To get group IDs for ls -l and ls -g.
/usr/lib/terminfo/* To get terminal information.
DG/UX 4.00 Page 4
Licensed material--property of copyright holder(s)
ls(1)
SEE ALSO
chmod(1), find(1).
CAVEATS
Unprintable characters in file names may confuse the columnar
output options.
DG/UX 4.00 Page 5
Licensed material--property of copyright holder(s)