Skip to Main Content
Unix in a Nutshell, 4th Edition
book

Unix in a Nutshell, 4th Edition

by Arnold Robbins
October 2005
Intermediate to advanced content levelIntermediate to advanced
908 pages
46h 42m
English
O'Reilly Media, Inc.
Content preview from Unix in a Nutshell, 4th Edition

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning the Unix Operating System, 5th Edition

Learning the Unix Operating System, 5th Edition

John Strang, Grace Todino, Jerry Peek
UNIX and Linux System Administration Handbook, 5th Edition

UNIX and Linux System Administration Handbook, 5th Edition

Trent R. Hein, Evi Nemeth, Garth Snyder, Ben Whaley, Dan Mackin

Publisher Resources

ISBN: 0596100299Errata Page