LS(1)

NAME
ls - list the contents of a directory

SYNOPSIS
ls [-acdfghilpqrstu1ACDFLMRTX] [name...]

DESCRIPTION
For each file argument, list it. For each directory argument, list its contents. The current working directory is listed when no files are named. Information is printed multicolumn on terminals, single column if the output is redirected. The options control what information is shown and how.

Ls has two sources other then the command line to draw options from, one is the environment variable LSOPTS that is scanned for option letters when the output of ls is displayed on a terminal. The other is the name of ls itself. If ls is linked to another name, then all the characters after the l are used as flags too, except that d, f, r, t and x are translated to D, F, R, T and X. Useful links are ll, lf, lm and lx.

Files whose names start with a dot are by default not listed.

Note that standard Minix doesn't have symbolic links or sockets and -u and -c are no-ops on a V1 file system, since only modified times are stored in V1 inodes.

OPTIONS

-a  All entries are listed, even . and ..

-c  Use inode changed time for sorting, listing or searching.

-d  Do not list contents of directories, but list the directory itself.

-f  Do not sort (should also be: treat a file as a directory, but that can't be implemented portably).

-g  Suppress the owner name on a long listing (implies -l).

-h  Show file sizes in kilo, mega or gigabytes.

-i  I-node number printed in the first column.

-l  Long listing: mode, links, owner, group, size and time. (ls -lC uses columns in a wide enough window!)

-n  Print numerical user and group id's.

-p  Mark directories with a '/'.

-q  Print nongraphic characters as '?' (default on terminals).

-r  Reverse the sort order.

-s  Give the size in kilobytes in the first (-s) or second column (-is).

-t  Sort by time (modified time default), latest first.

-u  Use last accessed time for sorting, listing or searching.

-1  Print in one column.

-A  List all entries, but not . and .. (This is the default for privileged users.)

-C  Print multicolumn (default on terminals).

-D  Distinguish files by type, i.e. regular files together, directories together, etc.

-F  Mark directories with a '/', executables with a '*', UNIX domain sockets with a '=', named pipes with a '|' and symbolic links with a '@' behind the name.

-L  Print the file referenced by a symbolic link instead of the link.

-M  List mode before name (implies -C).

-R  List directory trees recursively.

-T  Print file times in a long format, e.g. "Oct 24 21:37:41 1996".

-X  Print crunched mode and size before name (implies -C). Only the rwx permissions that its caller has on the file are shown, but they are in upper case if the caller owns the file and has given the permission to the callers group or other users. The size is listed in bytes (<= 5K), or rounded up kilo, mega or gigabytes.

SEE ALSO
du(1), stat(1), stat(2).

BUGS
Having to type ls -C when viewing files through more(1).

Is only portable to systems with the same st_mode (see stat(2)).

The LSOPTS variable and the -D, -M and -X flags are not found on other ls implementations. (They have their own nonstandard flags.)

AUTHOR
Kees J. Bot <kjb@cs.vu.nl>