The -1, -C, -x, and -l options all override each other; the last one specified determines the format used.

The -c, -u, and -U options all override each other; the last one specified determines the file time used.

The -S and -t options override each other; the last one specified determines the sort order used.

The -B, -b, -w, and -q options all override each other; the last one specified determines the format used for non-printable characters.

The -H, -L and -P options all override each other (either partially or fully); they are applied in the order specified.

NAME

ls - list file/directory information

SYNOPSIS

ls [-1ACFLRSTWacdfgiklmnopqrstux] [file ...]

DESCRIPTION

This program lists information about files and directories. If it is invoked without file/directory name arguments, it lists the contents of the current directory. Otherwise, ls lists information about the files and information about the contents of the directories (but see -d). Furthermore, without any option arguments ls just lists the names of files and directories. All files are listed before all directories. The default sort order is ascending ASCII on filename.

OPTIONS

The BSD options 1ACFLRSTWacdfgiklmnopqrstux are recognized, but only 1RSacdfiklnrstu are implemented:

-1

List entries 1 per line (default if output is not a tty). This is disabled by any of -C, -x, or -l.

-R

Recursively list the contents of all directories, breadth-first.

-S

Sort descending by size. This is disabled by -t.

-a

List all files (normally files starting with '.' are ignored).

-c

Sort by descending last modification time of inode. This is disabled by any of -u or -U.

-d

Do not list directory contents.

-f

Do not sort -- list in whatever order files/directories are returned by the directory read function. This option implies -a.

-i

List file inode number. (Doesn't mean much on non-inode systems.)

-k

When used with -s, list file/directory size in 1024-byte blocks.

-l

Long format listing of mode -- # of links, owner name, group name, size in bytes, time of last modification, and name.

-n

List numeric uid and gid (default on platforms without getpwuid()).

-r

Reverse sorting order.

-s

List file/directory size in 512-byte blocks. (May not mean much on non-Unix systems.)

-t

Sort by descending last modification time.

-u

Sort by descending last access time.

-w

Set the column width for the output. The default is the window size, or 80 if the program cannot determine the window size. A column width of 0 means unlimited.

ENVIRONMENT

The working of ls is not influenced by any environment variables.

BUGS

The file metadata from stat is used, which may not necessarily mean much on non-Unix systems. Specifically, the uid, gid, inode, and block numbers may be meaningless (or less than meaningful at least).

The -l option does not yet list the major and minor device numbers for special files, but it does list the value of the 'dev' field as 2 hex 16-bit words. Doing this properly would probably require filesystem type probing.

AUTHOR

This Perl implementation of ls was written by Mark Leighton Fisher of Thomson Consumer Electronics, fisherm@tce.com.

Portions of Stat::lsmode from Mark Jason Dominus have been inlined into this program uder the perl license. See http://www.plover.com/~mjd/perl/lsMode/.

COPYRIGHT and LICENSE

This program is free and open software. You may use, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.