Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ls(1) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chown(1)

chmod(1)

find(1)




ls(1) ls(1)
NAME ls - lists the contents of a directory SYNOPSIS ls [-a] [-b] [-c] [-C] [-d] [-F] [-g] [-i] [-l] [-L] [-m] [-n] [-o] [-p] [-q] [-r] [-R] [-s] [-t] [-u] [-x] [names] ARGUMENTS -a Lists all entries. Usually entries whose names begin with a period (.) are not listed. -b Forces printing of nongraphic characters to be in the octal \ddd notation. -c Uses the time of the last modification of the i-node (file created, mode changed, and so forth) for sorting (-t) or printing (-l). -C Specifies multicolumn output with entries sorted vertically. -d Lists the directory name only, not its contents. This option is often used with the -l option to get the status of a directory. This option does not apply if the a file is specified. -F Puts a slash (/) after each filename if that file is a directory, an asterisk (*) after each filename if that file is executable, and an (@) after each filename if that file is a symbolic link. -g Acts the same as the -l option except that the owner is not printed. -i Prints the i-number in the first column of the report, for each file. -l Lists in long format, giving mode, number of links, owner, group, size in bytes, and time of last modification for each file (see below). If the file is a special file, the size field will contain the major and minor device numbers, instead of a size. If the file is a symbolic link, the pathname of the linked-to file is printed preceded by ->. -L Lists the file's or directory's (if it is a symbolic link) link references rather than the link itself. -m Specifies stream output format. -n Acts the same as the -l option, except that the owner's user ID and group's group ID numbers, rather than the January 1992 1



ls(1) ls(1)
associated character strings, are printed. names Specifies the files or directories to be listed. -o Acts the same as the -l option except that the group is not printed. -p Puts a slash (/) after each filename if that file is a directory. -q Forces printing of nongraphic characters in filenames as the character (?). -r Reverses the order of sort to get reverse alphabetic or oldest first, as appropriate. -R Recursively lists subdirectories encountered. -s Gives size in 512-byte blocks, including indirect blocks, for each entry. -t Sorts by time modified (latest first), instead of by name. -u Uses the time of the last access, instead of the last modification, for sorting (with the -t option) or printing (with the -l option). -x Specifies multicolumn output with entries sorted horizontally, rather than down the page. DESCRIPTION For each directory argument, ls lists the contents of the directory; for each file argument, ls repeats the filename and any other information requested. The output is sorted alphabetically by default. When no argument is given, the current directory is listed. When several arguments are given, the arguments are first sorted appropriately, but with file arguments appearing before directory arguments and their contents. There are three major listing formats. The default format is to list one entry per line, the -C and -x options enable multicolumn formats, and the -m option enables stream output format, in which files are listed across the page, separated by commas. In order to determine output formats for the -C, -x, and -m options, ls uses an environment variable, COLUMNS, to determine the number of character positions available on one output line. If this variable is not set, the terminfo database is used to determine the number of columns, based on the environment variable TERM. If this 2 January 1992



ls(1) ls(1)
information cannot be obtained, 80 columns are assumed. The mode printed under the -l option consists of 10 characters that are interpreted below. The first character can be one of the following: d if the entry is a directory b if the entry is a block special file c if the entry is a character special file l if the entry is a symbolic link p if the entry is a fifo (named pipe) special file - if the entry is an ordinary file The next 9 characters are interpreted as three sets of three bits each. The first set refers to the owner's permissions; the next to permissions of others in the user-group of the file; and the last to all others. Within each set, the three characters indicate permission to read, to write, and to execute the file as a program, respectively. For a directory, ``execute'' permission is interpreted to mean permission to search the directory for a specified file. The permissions are indicated as follows: 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 set-group-ID mode; likewise, the user-execute permission character is given as s if the file has set- user-ID mode. The last character of the mode (normally x or -) is t if the 1000 (octal) bit of the mode is on; see chmod(1) for the meaning of this mode. The indications of set-ID and 1000 bits of the mode are capitalized (S and T, respectively) if the corresponding execute permission is not set. When the sizes of the files in a directory are listed, a total count of blocks, including indirect blocks, is printed. January 1992 3



ls(1) ls(1)
EXAMPLES The command: ls -l /etc will list all entries in /etc in long format, as, for example, -rw-r--r- 1 root bin 115 Mar 17 1986 mtab where the fields represent the file's permissions, number of links, owner, group, size in bytes, date of last modification, and name, respectively. LIMITATIONS Unprintable characters in filenames may confuse the columnar output options. FILES /bin/ls Executable file /etc/passwd File to get user IDs for ls -l and ls -o /etc/group File to get group IDs for ls -l and ls -g /usr/lib/terminfo/* Files to get terminal information SEE ALSO chown(1), chmod(1), find(1) 4 January 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026