| BSD options. | linux options |
-- terminates options, useful when filenames begin with a -
For a file; display its name and attributes.
For a directory; displays the files in that directory and attributes.
If no operands are given, the contents of the current directory are displayed.
If more than one operand is given (or implied with shell pattern match),
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Column formats -1, -C, -x, and -l override each other; the last one specified is used.
Sort time choices -c(change) and -u(access) override each other; the last one specified isused.
-B, -b, -w, and -q override each other; the last one specified determines the format used for non-displayable characters.
-b As -B, but use C escape codes whenever possible.
-H, -L and-P override each other (either partially or fully); they are applied in the order specified.
Default, one entry per line to standard output; to terminals or with -C or -x (multi column formats.)
File information is displayed with blanks separating the information associated with the -i, -s, and -l options.
-l displays : If the modification time of the file is more than 6 months away, the year is displayed instead of the hour and minutes.
If the owner or group names are not known (example they have been deleted), or
with -n numeric ID's are displayed.
For character special or block special files the major and minor device numbers for the file are displayed in the size field.
For symbolic links a -> and the pathname of the linked-to file is displayed
The type character describes the type of file :
- Regular file.
d Directory.
l Symbolic link.
b Block special file.
c Character special file.
s Socket link.
p FIFO.
The mode, the permssion flags, are three fields of three characters each
(ex: rwxrwxr-x ) :
user whos owns the file , group members , and others. r the file is readable; - not readable. w the file is writable; - not writable. S the file is not executable
s
the file is executable
x file is executable or directory is searchable. - file is neither readable, writable, executable, nor set-user-ID nor set-group-ID mode, nor sticky. T sticky bit is set (mode 1000), but not execute or search permission. t sticky bit is set (mode 1000), and is searchable or executable. + or
@ the file or directory has extended security information
total nnnnnn number of 512-byte blocks used by the files in the directory is displayed on a line by itself immediately before the information for the files in the directory.
EXAMPLES
Sort by size (and shows why ls does not need a separate option for this):
ls -l | sort -n +4
-r reverse sort order.
exits 0 on success, and >0 if an error occurs.
BLOCKSIZE default is 512.
CLICOLOR Use ANSI color sequences to distinguish file types. See LSCOLORS.
In addition to the file types mentioned in -F extra attributes (setuid bit set, etc.) are displayed.
Dependent terminal type with the proper termcap(5) capabilities. To display the colors in an xterm, the TERM variable may be set to xterm‑color. Other terminal types may require similar adjustments.
Disabled if the output isn't directed to a terminal unless CLICOLOR_FORCE is defined.
CLICOLOR_FORCE if set, color sequences are output if not directed to a terminal.
LSCOLORS Defines colors used when colors are enabled with CLICOLOR.
String of pairs of the format fb, where f is the foreground color and b is the background color.
a black | b red | c green | d brown
| |||||
e blue | f magenta | g cyan | h light grey
| |||||
A bold black | B bold red | C bold green | D bold brown, usually shows up as yellow
| |||||
E bold blue | F bold magenta | G bold cyan | H bold light grey; looks like bright white
| |||||
x default foreground or background
| ||||||||
The order of the attributes :
dir, symlink, socket, pipe, executable, block serial, character special, executable+SUID, executable+GUID, executabl+sticky+w=others, directory+w=others
Default "exfxcxdxbxegedabagacad",
i.e. blue foreground and default background for regular directories, magenta for symLinks, green for sockets,
…black on red for setuid executables, etc.
TERM CLICOLOR depends on a terminal type with color capabilities.
COLUMNS column width for displaying multiple-text-column output.
LS_COLWIDTHS a colon-delimited list of minimum column widths. Unreasonable and insufficient widths are ignored (zero signifies a dynamically sized column).
Not all columns have changeable widths.
inode, block count, number of links, user name, group name, flags, file size, file name.
LANG The locale to use when determining the order of day and month in the long -l format output. See environ .
TZ timezone to use when displaying dates. See environ(7) for more information.
SEE ALSO chflags, chmod, sort, xterm, compat, termcap, symlink, sticky