.TH ls "" "" Command
.PC "List directory's contents"
\fBls [\-abCcdFfgilmnopqRrstux] [\fIfile ... \fB]\fR
.PP
.HS
.SH Options:
.IC \fB\-a\fR
List all files (including `.' and `..')
.IC \fB\-b\fR
Print non-graphic characters in octal
.IC \fB\-C\fR
Print output in multi-column format, sorted down the columns
.IC \fB\-c\fR
Use attribute change instead of modified time for \fB\-l\fR and \fB\-t\fR
.IC \fB\-d\fR
Treat directories like files
.IC \fB\-F\fR
Print `/' after directories and `*' after executables
.IC \fB\-f\fR
Treat \fIfile\fR as a directory even if it is not
.IC \fB\-i\fR
Print the i-number as well
.IC \fB\-l\fR
Long format: show file type, permissions, size
.IC \fB\-m\fR
Output file names separated by commas
.IC \fB\-n\fR
Same as \fB\-l\fR
.IC \fB\-p\fR
Print `/' after directory names
.IC \fB\-q\fR
Print non-graphic characters as `?'
.IC \fB\-R\fR
Recursively display directories
.IC \fB\-r\fR
Reverse the order of all sorting
.IC \fB\-s\fR
Print the file size in blocks as well
.IC \fB\-t\fR
Sort by times, newest first
.IC \fB\-u\fR
Use accessed rather than modified time
.IC \fB\-x\fR
Print multicolumn output, sorted across the columns
.HE
The command
.B ls
prints information about each
.IR file .
Normally,
.B ls
sorts its output by file name and prints only the name of each
.IR file .
If a directory name is given as an argument,
.B ls
sorts and lists its contents,
not including `.' and `..'.
If no
.I file
is named,
.B ls
lists the contents of the current directory.
.PP
The following options control how
.B ls
sorts and displays its output:
.IP \fB\-a\fR
Print all directory entries,
including `.', `..', any hidden files, and volume ID's.
.IP \fB\-b\fR
Print non-graphic characters in octal.
.IP \fB\-C\fR
Print the output in multi-column format, sorted down the columns.
.IP \fB\-c\fR
Print the time the files' attributes were last changed.
.IP \fB\-d\fR
Treat directories as if they were files.
.IP \fB\-F\fR
Print a `/' after the name of each directory, and print an `*' after each
executable file.
.IP \fB\-f\fR
Force each argument to be treated as a directory.
This disables the
.B \-lrst
options and sorting, and enables the
.B \-a
option.
.\" .IP \fB\-g\fR
.\" Same as
.\" .B \-l
.\" except that the user id is not displayed.
.IP \fB\-i\fR
Print the i-number of each file.
.IP \fB\-l\fR
Print information in long format.
The fields give
mode bits, link count, owner uid, owner gid, size in bytes, date, and  file name.
For special files, major and minor device numbers
replace the size field.
.IP \fB\-m\fR
``Stream'' the output horizontally across the screen, with each file name
separated by a comma.
.IP \fB\-n\fR
Same as
.BR \-l ,
except the group identifiers and user identifiers are numbers rather than
names.
.IP \fB\-o\fR
Same as
.BR \-l ,
except that the group id is not printed.
.IP \fB\-p\fR
Print a `/' after each directory name.
.IP \fB\-q\fR
Print non-graphics characters as `?'.
.IP \fB\-r\fR
Reverse the sense of the sort.
.IP \fB\-R\fR
Recursively print directories.
.IP \fB\-s\fR
Print the size in blocks of each file.
.IP \fB\-t\fR
Sort by time, newest first.
.IP \fB\-u\fR
Sort by the
.I access
time.
.IP \fB\-x\fR
Print multicolumn output, sorted across the columns.
This resembles the output of the command
.BR lc .
.PP
The date
.B ls
prints with the
.B \-l
and
.B \-t
options is the
.I modification
time, unless the
.B \-c
or
.B \-u
option is used as well.
.PP
The mode field in the long list format consists of ten characters.
The first character will be one of the following:
.DS
	\fB-\fR	Regular file
	\fBb\fR	Block special file
	\fBc\fR	Character special file
	\fBd\fR	Directory
	\fBp\fR	Pipe
	\fBx\fR	Bad entry (remove it immediately!)
.DE
.PP
The remaining nine characters are permission bits,
in three sets of three characters each.
The first set pertains to the owner of the file,
the second to users from the owner's group, and
the third to users from other groups.
Each set may contain three characters from the following.
.DS
	\fBr\fR	The file can be read
	\fBs\fR	Set effective user ID or group ID on execution
	\fBt\fR	Shared text is sticky
	\fBw\fR	The file can be written
	\fBx\fR	The file is executable
	\fB\-\fR	No permission is given
.DE
.SH "Links"
\*(CO includes several commands that are links to
.B ls
and its options, to make it easier for you to use the various features of
.BR ls .
The following table gives each command and the form of \fBls\fR to which
it is linked:
.DS
	\fBl\fR	\fBls \-l\fR
	\fBlf\fR	\fBls \-CF\fR
	\fBlr\fR	\fBls \-CR\fR
	\fBlx\fR	\fBls \-x\fR
.DE
.SH "See Also"
.Xr "chmod," chmod
.Xr "commands," commands
.Xr "l," l
.Xr "lc," lc
.Xr "lf," lf
.Xr "lr," lr
.Xr "lx," lx
.Xr "stat" stat
