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, lc, l, ll, lsf, lsr, lsx - list contents of directories SYNOPSIS
[names] [names] [ls_options] [names] [ls_options] [names] [ls_options] [names] [ls_options] [names] [ls_options] [names] DESCRIPTION
For each directory argument, the command lists the contents of the directory. For each file argument, repeats its name and any other information requested. The output is sorted in ascending collation order by default (see Environment Variables below). When no argument is given, the current directory is listed. When several arguments are given, the arguments are first sorted appropriately, but file argu- ments appear before directories and their contents. If you are a user with appropriate privileges, all files except and are listed by default. There are three major listing formats. The format chosen depends on whether the output is going to a login device (determined by whether output device file is a device), and can also be controlled by option flags. The default format for a login device is to list the contents of directories in multicolumn format, with entries sorted vertically by col- umn. (When individual file names (as opposed to directory names) appear in the argument list, those file names are always sorted across the page rather than down the page in columns because individual file names can be arbitrarily long.) If the standard output is not a login device, the default format is to list one entry per line. The and options enable multicolumn formats, and the option enables stream output format in which files are listed across the page, sepa- rated by commas. In order to determine output formats for the and options, uses an environment variable, to determine the number of char- acter positions available on each output line. If this variable is not set, the database is used to determine the number of columns, based on the environment variable If this information cannot be obtained, 80 columns is assumed. The command functions the same as except that the default output is columnar, even if output is redirected. Options recognizes the following options: List all entries; usually entries whose names begin with a period are not listed. List nonprinting characters in the octal notation. Use time of last modification of the inode (file created, mode changed, etc.) for sorting or printing (ell)). If an argument is a directory, list only its name (not its contents); often used with (ell) to get the status of a directory. Under the UNIX 2003 environment (see standards(5)), with does not follow symbolic links unless the or option is specified. List the extent attributes of the file. If any of the files has a extent attribute, this option lists the extent size, space reserved and allocation flags. This option must be used with the (ell) option. Interpret each argument as a directory and list the name found in each slot. This option disables (ell), and and enables the order is the order in which entries appear in the directory. Same as (ell), except that only the group is printed (owner is omitted). If both (ell) and are specified, the owner is not printed. For each file, list the inode number in the first column of the report. When used in multicolumn output, the number precedes the file name in each column. (ell) List in long format, giving mode, number of links, owner, group, size in bytes, and time of last modification for each file (see further and below). If the time of last modi- fication is greater than six months ago, or any time in the future, the year is substituted for the hour and minute of the modification time. If the file is a special file, the size field contains the major and minor device numbers rather than a size. If the file is a symbolic link, the filename is printed, followed by and the pathname of the referenced file. Under the UNIX 2003 environment (see standards(5)), with does not follow symbolic links unless the or option is specified. Stream output format. The same as (ell) except that the owner's UID and group's GID numbers are printed, rather than the associated character strings. The same as (ell) except that only the owner is printed (group is omitted). (If both (ell) and are specified, the group is not printed). Put a slash after each file name if that file is a directory. List nonprinting characters in file names as the character Reverse the order of sort to get reverse (descending) collation or oldest first, as appropriate. List size in blocks of 512-byte units, including indirect blocks, for each entry. The first entry listed is the total number of blocks in the directory. When used in multicolumn output, the number of blocks precedes the file name in each column. The number of indirect blocks in a file is filesystem dependent. Sort by time modified (latest first) before sorting alphabetically. Use time of last access instead of last modification for sorting option) or printing (ell) option). List multicolumn output with entries sorted across rather than down the page. The same as except that the current directory and parent directory are not listed. For a user with appropriate privileges, this flag defaults to on, and is turned off by List multicolumn output with entries sorted down the columns. After each file name, put one of: o A slash if the file is a directory or a symbolic link to a directory. o An asterisk if the file is executable; o An at-sign if the file is a symbolic link to a file; o A vertical bar if the file is a fifo. Under the UNIX 2003 environment (see standards(5)), with does not follow symbolic links unless the or option is specified. If a symbolic link referencing a file of type directory is specified on the command line, evaluates the file information and file type to be those of the file referenced by the link, and not the link itself. However, writes the name of the link itself and not the file referenced by the link. Evaluate the file information and file type for all symbolic links (whether named on the command line or encountered in a file hierarchy) to be those of the file referenced by the link, and not the link itself. However, writes the name of the link itself and not the file referenced by the link. When is used with write the contents of symbolic links in the long format. Recursively list subdirectories encountered. (one) List the file names in single column format regardless of the output device. This forces single column format to the user's terminal. Specifying more than one of the options in the following mutually exclusive pairs is not considered an error: and (ell), and (ell), and (ell), and (one), and and and is known by several shorthand-version names for the various formats: is equivalent to is equivalent to (ell) is equivalent to is equivalent to is equivalent to The shorthand notations are implemented as links to Option arguments to the shorthand versions behave exactly as if the long form above had been used with the additional arguments. The mode printed in listings produced by the (ell) option consists of 10 characters, for example, The first character indicates the entry type: Block special file Character special file Directory Symbolic link Network special file Fifo (also called a "named pipe") special file Socket Ordinary file The next 9 characters are interpreted as three sets of three characters each which identify access and execution permissions for the owner, group, and others categories, as described in chmod(1). The indicates the permission is not granted. The various permissions can be put together in any combination, except that the and characters are mutually exclusive, as implied below. Read by owner Write by owner Execute (or search directory) by owner; do not set user ID on execution Execute/search by owner; set user ID on execution No execute/search by owner; set user ID on execution Read by group Write by group Execute/search by group; do not set group ID on execution Execute/search by group; set group ID on execution No execute/search by group; set group ID on execution Read by others Write by others Execute/search by others; do not set sticky bit on execution Execute/search by others; set sticky bit on execution No execute/search by others; set sticky bit on execution The mode characters are interpreted as follows: Deny all permissions in the corresponding position. Grant read permission to the corresponding user class. Grant write permission to the corresponding user class. Grant execute (or search in directory) permission to the corresponding user class. Grant execute (search) permission to the corresponding user class. Execute the file as if by the owner (set user ID, SUID) or group (set group ID, SGID), as indicated by position. Deny execute (search) permission to the corresponding user class. Execute the file as if by the owner (set user ID, SUID) or group (set group ID, SGID), as indicated by position. Grant execute (search) permission to others. The "sticky" bit is set (see the description of in chmod(2)). Deny execute (search directory) permission to others. The "sticky" bit is set. When an option is specified that results in a listing of directory and/or file sizes in bytes or blocks (such as the or (ell) option), a total count of blocks, including indirect blocks, is also printed at the beginning of the listing. Access Control Lists (ACLs) If a file has optional ACL entries, the (ell) option displays a plus sign after the file's permissions. The permissions shown are a sum- mary representation of the file's access control list, as returned by in the field (see stat(2)). To list the contents of an access con- trol list, use the command (see lsacl(1) and acl(5)) for HFS file systems, or the command (see getacl(1) and aclv(5)) for JFS file systems. EXTERNAL INFLUENCES
For information about the UNIX standard environment, see standards(5). Environment Variables If the variable is set, uses the width provided in determining positioning of columnar output. determines the locale to use for the locale categories when both and the corresponding environment variable (beginning with do not specify a locale. If is not set or is null, it defaults to (see lang(5)). determines the order in which the output is sorted. determines which characters are classified as nonprinting for the and options, and the interpretation of single- and/or multibyte charac- ters within file names. determines the date and time strings output by the (ell), and options. determines the language in which messages (other than the date and time strings) are displayed. If any internationalization variable contains an invalid setting, they all default to (see environ(5)). International Code Set Support Single- and multibyte character code sets are supported. RETURN VALUE
exits with one of the following values: All input files were listed successfully. was aborted because errors occurred when accessing files. The following conditions cause an error: o Specified file not found. o User has no permission to read the directory. o Process could not get enough memory. o Invalid option specified. EXAMPLES
Print a long listing of all the files in the current working directory (including the file sizes). List the most recently modified (youngest) file first, followed by the next older file, and so forth, to the oldest. Files whose names begin with a are also printed. WARNINGS
Setting options based on whether the output is a login (tty) device is undesirable because is very different from On the other hand, not using this setting makes old shell scripts that used almost inevitably fail. Nonprinting characters in file names (without the or option) may cause columnar output to be misaligned. DEPENDENCIES
NFS The (ell) option does not display a plus sign after the access permission bits of networked files to represent existence of optional access control list entries. AUTHOR
was developed by AT&T, the University of California, Berkeley and HP. FILES
For group IDs for (ell) and For user IDs for (ell) and For terminal information. SEE ALSO
chmod(1), find(1), getacl(1), lsacl(1), stat(2), acl(5), aclv(5), standards(5). STANDARDS CONFORMANCE
ls(1)
Man Page