Name
ls
Synopsis
ls [options
] [names
]
If no names are given, list the files
in the current directory. With one or more
names, list files contained in a directory
name or that match a file
name. The options let you display a variety
of information in different formats. The most useful options
include -F
, -R
,
-a
, -l
, and -s
.
Some options don’t make sense together; e.g., -u
and -c
.
Tip
Modern versions of ls
pay attention to the LC_COLLATE environment variable. Its
default value, en_US
, (in the
United States) causes ls to
sort in dictionary order (i.e., ignoring case). You may prefer
to set LC_COLLATE to C
to
restore the traditional Unix behavior of sorting in ASCII
order.
Common Options
-a
,--all
List all files, including the normally hidden
.
files.-A
,--almost-all
Like
-a
, but exclude . and .. (the current and parent directories).-b
,--escape
Show nonprinting characters in octal.
-c
,--time-ctime
,--time=status
List files by inode modification time.
-C
,--format=vertical
List files in columns (the default format, when displaying to a terminal device).
-d
,--directory
List only the directory’s information, not its contents. (Most useful with
-l
and-i
.)-
-f
Interpret each name as a directory (files are ignored).
-F
,--classify
,--indicator-style=classify
Flag filenames by appending
/
to directories,>
to doors (Solaris only),*
to executable files,|
to FIFOs,@
to symbolic links, and=
to sockets.-
-g
Like
-l
, but omit owner name (show group).-
-h
Produce “human-readable” output, using abbreviations ...
Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.