Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ls(1) [v7 man page]

LS(1)							      General Commands Manual							     LS(1)

NAME
ls - list contents of directory SYNOPSIS
ls [ -ltasdrucifg ] name ... DESCRIPTION
For each directory argument, ls lists the contents of the directory; for each file argument, ls repeats its name 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 file arguments appear before directories and their contents. There are several options: -l List in long format, giving mode, number of links, owner, size in bytes, and time of last modification for each file. (See below.) If the file is a special file the size field will instead contain the major and minor device numbers. -t Sort by time modified (latest first) instead of by name, as is normal. -a List all entries; usually `.' and `..' are suppressed. -s Give size in blocks, including indirect blocks, for each entry. -d If argument is a directory, list only its name, not its contents (mostly used with -l to get status on directory). -r Reverse the order of sort to get reverse alphabetic or oldest first as appropriate. -u Use time of last access instead of last modification for sorting (-t) or printing (-l). -c Use time of last modification to inode (mode, etc.) instead of last modification to file for sorting (-t) or printing (-l). -i Print i-number in first column of the report for each file listed. -f Force each argument to be interpreted as a directory and list the name found in each slot. This option turns off -l, -t, -s, and -r, and turns on -a; the order is the order in which entries appear in the directory. -g Give group ID instead of owner ID in long listing. The mode printed under the -l option contains 11 characters which are interpreted as follows: the first character is 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; - if the entry is a plain file. The next 9 characters are interpreted as three sets of three bits each. The first set refers to owner permissions; the next to permissions to others in the same user-group; and the last to all others. Within each set the three characters indicate permission respectively to read, to write, or to execute the file as a program. 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 bit of the mode is on. See chmod(1) for the meaning of this mode. When the sizes of the files in a directory are listed, a total count of blocks, including indirect blocks is printed. FILES
/etc/passwd to get user ID's for `ls -l'. /etc/group to get group ID's for `ls -g'. LS(1)

Check Out this Related Man Page

ls(1B)																	    ls(1B)

NAME
ls - list the contents of a directory SYNOPSIS
/usr/ucb/ls [-aAcCdfFgilLqrRstu1] file... For each filename that is a directory, ls lists the contents of the directory; for each filename that is a file, ls repeats its name and any other information requested. By default, the output is sorted alphabetically. When no argument is given, the current directory is listed. When several arguments are given, the arguments are first sorted appropriately, but file arguments are processed before directories and their contents. Permissions Field The mode printed under the -l option contains 10 characters interpreted as follows. If the first character is: d Entry is a directory. D Entry is a door. b Entry is a block-type special file. c Entry is a character-type special file. l Entry is a symbolic link. p Entry is a FIFO (also known as "named pipe") special file. s Entry is an AF_UNIX address family socket. - Entry is a plain file. The next 9 characters are interpreted as three sets of three bits each. The first set refers to owner permissions; the next refers to per- missions to others in the same user-group; and the last refers to all others. Within each set, the three characters indicate permission respectively to read, to write, or to execute the file as a program. For a directory, "execute" permission is interpreted to mean permis- sion to search the directory. The permissions are indicated as follows: r The file is readable. w The file is writable. x The file is executable. - 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 owner-execute permission char- acter is given as s if the file has the set-user-id bit set. The last character of the mode (normally x or `-') is true if the 1000 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. A plus sign (+) appended to the list of permissions indicates that an ACL is associated with the file. When the sizes of the files in a directory are listed, a total count of blocks, including indirect blocks, is printed. The following options are supported: -a Lists all entries; in the absence of this option, entries whose names begin with a `.' are not listed (except for the privileged user, for whom ls normally prints even files that begin with a `.'). -A Same as -a, except that `.' and `..' are not listed. -c Uses time of last edit (or last mode change) for sorting or printing. -C Forces multi-column output, with entries sorted down the columns; for ls, this is the default when output is to a terminal. -d If argument is a directory, lists only its name (not its contents); often used with -l to get the status of a directory. -f Forces each argument to be interpreted as a directory and lists the name found in each slot. This option turns off -l, -t, -s, and -r, and turns on -a; the order is the order in which entries appear in the directory. -F Marks directories with a trailing slash (/), doors with a trailing greater-than sign (>), executable files with a trailing aster- isk (*), FIFOs with a trailing vertical bar (|), symbolic links with a trailing at-sign (@), and AF_UNIX address family sockets with a trailing equals sign (=). -g For ls, shows the group ownership of the file in a long output. -i For each file, prints the i-node number in the first column of the report. -l Lists in long format, giving mode, ACL indication, number of links, owner, size in bytes, and time of last modification for each file. If the file is a special file the size field will instead contain the major and minor device numbers. If the time of last modification is greater than six months ago, it is shown in the format `month date year'; files modified within six months show `month date time'. If the file is a symbolic link, the pathname of the linked-to file is printed preceded by `-->'. -L If argument is a symbolic link, lists the file or directory the link references rather than the link itself. -q Displays non-graphic characters in filenames as the character ?; for ls, this is the default when output is to a terminal. -r Reverses the order of sort to get reverse alphabetic or oldest first as appropriate. -R Recursively lists subdirectories encountered. -s Indicate the total number of file system blocks consumed by each file displayed. -t Sorts by time modified (latest first) instead of by name. -u Uses time of last access instead of last modification for sorting (with the -t option) and/or printing (with the -l option). -1 Forces one entry per line output format; this is the default when output is not to a terminal. The following operand is supported: file A path name of a file to be listed. If the file specified is not found, a diagnostic message is output on standard error. See largefile(5) for the description of the behavior of ls when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes). /etc/group to get group ID for `ls -g' /etc/passwd to get user IDs for `ls -l' and `ls -o' See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ ls(1), attributes(5), largefile(5) NEWLINE and TAB are considered printing characters in filenames. The output device is assumed to be 80 columns wide. 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 losers. Unprintable characters in file names can confuse the columnar output options. 5 May 2005 ls(1B)
Man Page