Manual page for LS(1V)
ls - list the contents of a directory
SYNOPSIS
ls
[
-aAcCdfFgilLqrRstu1
]
filename
...
SYSTEM V SYNOPSIS
/usr/5bin/ls
[
-abcCdfFgilLmnopqrRstux
]
filename
...
AVAILABILITY
The System V version of this command is available with the
System V
software installation option.
Refer to
[a manual with the abbreviation INSTALL]
for information on how to install optional software.
DESCRIPTION
For each
filename
which is a directory,
ls
lists the contents of the directory; for each
filename
which is a file,
ls
repeats its name and any other information
requested.
By default, the output is sorted alphabetically.
When no argument is given, the current directory is listed.
When several arguments are given,
the arguments are first sorted
appropriately, but file arguments are
processed before directories and their contents.
In order to determine output formats for the
-C,
-x,
and
-m
options,
/usr/5bin/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.
Permissions Field
The mode printed under the
-l
option contains 10 characters interpreted as follows.
If the first character is:
-
- d
-
entry is a directory;
- b
-
entry is a block-type special file;
- c
-
entry is a character-type special file;
- l
-
entry is a symbolic link;
- p
-
entry is a
FIFO
(also known as ``named pipe'') special file;
- s
-
entry is an
AF_UNIX
address family socket, or
- -
-
entry is a plain file.
The next 9 characters are interpreted as three sets of three
bits each.
The first set refers to owner permissions; the next refers to
permissions to
others in the same user-group; and the last refers to all
others.
Within each
set the three characters indicate permission respectively to
read, to write, or to execute the file as a program.
For a
directory, ``execute''
permission is interpreted to mean permission to search the
directory.
The permissions are indicated as follows:
-
- r
-
the file is readable;
- w
-
the file is writable;
- x
-
the file is executable;
- -
-
the indicated permission is not granted.
The group-execute permission character is given as
s
if the file has the set-group-id bit set;
likewise the owner-execute permission character is given as
s
if the file has the set-user-id bit set.
The last character of the mode (normally
x
or
`-')
is
t
if the 1000 bit of the mode is on.
See
chmod.1v
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
count
of blocks,
including indirect blocks is printed.
OPTIONS
- -a
-
List all entries; in the absence of this option, entries whose
names begin with a
`.'
are
not
listed (except for the super-user, for whom
ls,
but not
/usr/5bin/ls,
normally prints even files that begin with a
`.').
- -A
-
(ls
only) Same as
-a,
except that
`.'
and
`..'
are not listed.
- -c
-
Use time of last edit (or last mode change) for sorting or printing.
- -C
-
Force multi-column output, with entries sorted down the columns;
for
ls,
this is the default when output is to a terminal.
- -d
-
If argument is a directory, list only its name
(not its contents); often used with
-l
to get the status of a directory.
- -f
-
Force each argument to be interpreted as
a directory and list the name
found in each slot.
This option turns off
-l,
-t,
-s,
and
-r,
and turns on
-a;
the order is the order in which entries appear in the directory.
- -F
-
Mark directories with a trailing slash
(`/'),
executable files with a trailing asterisk
(`*'),
symbolic links with a trailing at-sign
(`@'),
and
AF_UNIX
address family sockets with a trailing equals sign
(`=').
- -g
-
For
ls,
show the group ownership of the file in a
long output.
For
/usr/5bin/ls,
print a long listing, the same as
-l,
except that the owner is not printed.
- -i
-
For each file, print the i-number in the first column of the report.
- -l
-
List in long format, giving mode, number
of links, owner, size in bytes,
and time of last modification for each file.
If the file is a special file the size field will instead
contain the major and minor device numbers.
If the time of last modification is greater than six months ago,
it is shown in the format
`month date year';
files modified within six months show
`month date time'.
If the file is a symbolic link the pathname of the
linked-to file is printed preceded by
`-->'.
/usr/5bin/ls
will print the group in addition to the owner.
- -L
-
If argument is a symbolic link, list the file or directory the
link references rather than the link itself.
- -q
-
Display non-graphic characters in filenames as
the character
?;
for
ls,
this is the default when output is to a terminal.
- -r
-
Reverse the order of sort to get reverse alphabetic
or oldest first as appropriate.
- -R
-
Recursively list subdirectories encountered.
- -s
-
Give size of each file, including any
indirect blocks used to map the file,
in kilobytes
(ls)
or 512-byte blocks
(/usr/5bin/ls).
- -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) and/or printing (with the
-l
option).
- -1
-
(ls
only)
Force one entry per line output format; this is the default
when output is not to a terminal.
SYSTEM V OPTIONS
- -b
-
Force printing of non-graphic characters to be
in the octal
\ddd
notation.
- -m
-
Stream output format; the file names are printed
as a list separated by commas, with as many
entries as possible printed on a line.
- -n
-
The same as
-l,
except that the owner's
UID
and group's
GID
numbers are printed, rather than
the associated character strings.
- -o
-
The same as
-l,
except that the group is not printed.
- -p
-
Put a slash
(`/')
after each filename if that file is a directory.
- -x
-
Multi-column output with entries sorted across
rather than down the page.
ENVIRONMENT
The environment variables
LC_CTYPE,
LANG,
and
LC_default
control the character classification
throughout
ls.
On entry to
ls,
these environment variables are checked in the
following order:
LC_CTYPE,
LANG,
and
LC_default.
When a valid value is found,
remaining environment variables for character classification
are ignored.
For example, a new setting for
LANG
does not override the current valid character
classification rules of
LC_CTYPE.
When none of the values is valid,
the shell character
classification defaults to the
POSIX.1 ``C''
locale.
FILES
- /etc/passwd
-
to get user
ID's
for
`ls -l'
and
`ls -o'.
- /etc/group
-
to get group
ID
for
`ls -g'
and
`/usr/5bin/ls -l'.
- /usr/share/lib/terminfo/*
-
to get terminal information for
/usr/5bin/ls.
SEE ALSO
chmod.1v
BUGS
NEWLINE
and
TAB
are considered printing characters in filenames.
The output device is assumed to be 80 columns wide.
The option setting based on whether the output is a teletype is
undesirable as
`ls -s'
is much different than
`ls -s | lpr'.
On the other hand, not doing this setting would
make old shell scripts which used
ls
almost certain losers.
None of the above apply to
/usr/5bin/ls.
Unprintable characters in file names may confuse the
columnar output options.
Created by unroff & hp-tools.
© somebody (See intro for details). All Rights Reserved.
Last modified 11/5/97