Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ls(1) [minix man page]

LS(1)							      General Commands Manual							     LS(1)

NAME
ls - list the contents of a directory SYNOPSIS
ls [-acdfgilqrstu1ACFLMRTX] [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 informa- tion is shown and how. Ls has two sources other then the commands line to draw options from, one is the environment variable LSOPTS and is used only when the out- put 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 f, r, t and x are translated to 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). -i I-node number printed in 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. -q Print nongraphic characters as '?' (default on terminals). -r Reverse the sort order. -s Give size in kilobytes. -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). -F Mark directories with a '/', executables with a '*', UNIX domain sockets 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 Group files by type, i.e. regular files together, directories together, etc. -X Print crunched mode and size before name (implies -C). Only the rwx permissions that its caller has on the file, 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 -M, -T and -X flags are not found on other ls implementations. (They have there own nonstandard flags.) AUTHOR
Kees J. Bot (kjb@cs.vu.nl) LS(1)

Check Out this Related Man Page

ls(1)							      General Commands Manual							     ls(1)

Name
       ls - list and generate statistics for files

Syntax
       ls [ options ] name ...

Description
       For each directory argument, lists the contents of the directory.  For each file argument, repeats the file name and gives any other infor-
       mation you request with the options available.  By default, the list is sorted alphabetically.  When no	argument  is  given,  the  current
       directory  is  listed.	When several arguments are given, files are listed first, followed by directories and the files within each direc-
       tory.  Options are listed below.

Options
       -1   Displays one entry per line.  This is the default when output is not to a terminal.

       -a   Displays all entries including those beginning with a period (.).

       -C   Forces multicolumn output for pipe or filter.  This is the default when the output is to a terminal.

       -c   Uses time of last file status change (ctime), reflecting file creation, mode, etc., for sorting (with the -t option) or printing (with
	    the -l option) rather than the time of file modification or access. See also the -t and -u options.

       -d   Displays names of directories only, not contents.  Use this option with -l to get the status of a directory.

       -F   Marks  directories	with  trailing	slash (/), sockets with a trailing equal sign (=), symbolic links with a trailing at sign (@), and
	    executable files with a trailing asterisk (*).

       -f   Displays names in the order they exist in directory.  For further information, see Entries	beginning  with  a  period  (.)  are  also
	    listed.  This option overrides the -l, -t, -s, and -r options.

       -g   Displays assigned group ID (used with -l only).  Default is assigned owner ID.

       -i   Displays the i-number for each file in the first column of the report.

       -L   Lists  the	information,  if  the file is a symbolic link, for the file or directory the link references rather than that for the link
	    itself.

       -l   Lists the mode, number of links, owner, size in bytes, and time of last modification (mtime) for each file.  If the file is a  special
	    file, the size field contains the major and minor device numbers instead of the size.  If the file is a symbolic link, the pathname of
	    the linked-to file is printed, preceded by ``->''.

	    The mode field consists of 11 characters.  The first character indicates the type of entry:

	    d if the entry is a directory
	    b if the entry is a block-type special file
	    c if the entry is a character-type special file
	    l if the entry is a symbolic link
	    s if the entry is a socket
	    - if the entry is a plain file

	    The next 9 characters are interpreted as three sets of three characters each.  The first set of three characters refers to file-access
	    permissions  for  the user; the next set, for the user-group; and the last set, for all others.  The permissions are indicated as fol-
	    lows:

	    r if the file is readable
	    w if the file is writable
	    x if the file is executable
	    - if the indicated permission is not granted.

	    The group-execute permission character is given as s if the file has the set-group-id bit set; likewise, the  user-execute	permission
	    character is given as s if the file has the set-user-id bit set.

	    The last character of the mode (normally `x' or `-') is t if the 1000 bit of the mode is on.  See for the meaning of this mode.

       -q   Forces  the printing of nongraphic characters in file names as the question mark character (?).  This is the default when output is to
	    a terminal.

       -R   Recursively lists all subdirectories.

       -r   Sorts entries in reverse alphabetic or time order.

       -s   Displays the size in kilobytes of each file.  This is the first item listed in each entry.

       -t   Sorts by time modified (most recently modified first) instead of by name. See also the -c and -u options.

       -u   Uses the time of last access (atime) instead of last modification for sorting (with the -t option) or printing (with the -l option).

Restrictions
       The output device is assumed to be 80 columns wide.

       New line and tab are considered printing characters in file names.

       The option setting based on whether the output is a teletype is undesirable as "ls -s" is much different than "ls -s |lpr".  On	the  other
       hand, not doing this setting would make old shell scripts which used ls almost certain to fail.

Files
       Used to obtain user id's for ls -l

       Used to obtain group id's for ls -g

See Also
       stat(2)

																	     ls(1)
Man Page