Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ls(1) — OSF/1 X2.0-8 MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

ctab(1)

find(1)

ln(1)

stty(1)

ioctl(2)

ctab(4)

ls(1)  —  Commands

OSF  —  Environment_Note_Added

NAME

ls − Lists and generates statistics for files

SYNOPSIS

ls [-aAbcCdfFgilLmnopqrRstux1] [file ...  | directory ...]

The ls command writes to standard output the contents of each specified directory or the name of each specified file, along with any other information you ask for with flags.  If you do not specify a file or a directory, ls displays the contents of the current directory. 

FLAGS

-aLists all entries in the directory, including the entries that begin with a . (dot). 

-ALists all entries, except . (dot) and ..  (dot-dot). 

-bDisplays nonprintable characters in octal notation. 

-cUses the time of last modification (file created, mode changed, and so on) for sorting (when used with -t) or for displaying (when used with -l).  This flag has no effect when not used with either -t or -l or both. 

-CSorts output vertically in a multicolumn format.  This is the default when output is to a terminal. 

-dDisplays only the information for the directory that is named, rather than for its contents.  This is useful with the -l flag to get the status of a directory. 

-fLists the name in each slot for each named directory.  This flag turns off -l, -t, -s, and -r, and turns on -a; this flag uses the order in which entries appear in the directory. 

-FPuts a / (slash) after each filename if the file is a directory, an ∗ (asterisk) after each filename if the file can be executed, an = (equal sign) after each filename if the file is a socket, and an @ (at sign) for a symbolic link. 

-gDisplays the same information as -l, except for the owner. 

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

-lDisplays the mode, number of links, owner, group, size (in bytes), and time of last modification for each file.  If the file is a special file, the size field instead contains the major and minor device numbers.  If the file is a symbolic link, the pathname of the linked-to file is also printed preceded by ->.  The attributes of the symbolic link are displayed.  The -n flag overrides the -l flag. 

-LLists the file or directory the link references rather than the link itself, if the argument is a symbolic link. 

-mUses stream output format (a comma-separated series). 

-nDisplays the same information as -l, except that it displays the user and the group IDs instead of the usernames and group names. 

-oDisplays the same information as with -l, except for the group.  The -n flag overrides the -o flag. 

-pPuts a slash after each filename if that file is a directory. 

-qDisplays nonprintable characters in filenames as a ? (question mark) character, if output is to a terminal (default). 

-rReverses the order of the sort, giving reverse collation or the oldest first, as appropriate. 

-RLists all subdirectories recursively. 

-sGives space used in kilobytes (including indirect blocks) for each entry. 

-tSorts by time of last modification (latest first) instead of by name. 

-uUses the time of the last access instead of time of the last modification for sorting (when used with -t) or for displaying (when used with -l).  This flag has no effect when not used with either -t or -l or both. 

-xSorts output horizontally in a multicolumn format. 

-1Forces one entry per line output format; this is the default when output is not directed to a terminal. 

DESCRIPTION

By default, ls displays all information in collated order by filename.  The collating sequence is determined by the LC_COLLATE environment variable (see the ctab command). 

There are three main ways to format the output:

       •List entries in multiple columns by specifying either the -C or -x flags.  -C is the default format, when output is to a terminal. 

       •List one entry per line. 

       •List entries in a comma-separated series by specifying the -m flag. 

The ls command uses ioctl() to determine the number of byte positions in the output line.  If ls cannot get this information, it uses a default value of 80.  Note that columns may not be smaller than 20 bytes or larger than 400 bytes. 

Modes

The mode displayed with the -l flag is interpreted by the first character, as follows:

bBlock special file

cCharacter special file

dDirectory

lSymbolic link

pFirst-In-First-Out (FIFO) special file

sLocal socket

-Ordinary file

Permissions

The next nine characters are divided into three sets of three characters each.  The first three characters show the owner’s permission.  The next set of three characters show the permission of the other users in the group.  The last set of three characters show the permission of everyone else.  The three characters in each set show read, write and execute permission of the file.  Execute permission of a directory lets you search a directory for a specified file. 

Permissions are indicated as follows:

rread

wwrite

xexecute or search (directories)

-no access

The group-execute permission character is s if the file has set-group-ID mode.  The user-execute permission character is s if the file has set-user-ID mode.  The last character of the mode (normally x or -) is t if the 01000 (octal) bit of the mode is set; see the chmod command for the meaning of this mode.  The indications of set-ID and the 01000 bit 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, the ls command displays a total count in kilobytes, including indirect blocks. 

The LC_TIME environment variable controls the format of the date and time. 

EXAMPLES

     1.To list all files in the current directory, enter:

ls  -a

This lists all files, including . (dot), .. (dot-dot), and other files with names beginning with a dot.

     2.To display detailed information, enter:

ls  -l  chap1  .profile

This displays a long listing with detailed information about the files chap1 and .profile. 

     3.To display detailed information about a directory, enter:

ls  -d  -l  .  manual  manual/chap1

This displays a long listing for the directories . and manual, and for the file manual/chap1.  Without the -d flag, this command lists the files in . and manual instead of providing detailed information about the directories themselves. 

     4.To list the files in the current directory in order of modification time, enter:

ls  -l  -t

This displays a long listing of the files that were modified most recently, followed by the older files.

FILES

/etc/passwdContains user information. 

/etc/groupContains group information. 

ENVIRONMENT NOTES

This section describes system features that are not generic to OSF/1 but that are provided in this OSF/1 implementation. 

System V Compatibility

The root of the directory tree that contains the commands modified for SVID-2 compliance is specified in the file /etc/svid2_path. You can use /etc/svid2_profile as the basis for, or to include in, your .profile.  The file /etc/svid2_profile reads /etc/svid2_path and sets the first entries in the PATH environment variable so that the modified SVID-2 commands are found first. 

The SVID-2 compliant version of the ls command produces multi-column output only if the -C option is specified.  In addition, the -s option of the SVID-2 compliant command causes file sizes to be reported in 512-byte units rather than in 1024-byte units. 

RELATED INFORMATION

Commands:  chmod(1), ctab(1), find(1), ln(1), stty(1). 

Functions:  ioctl(2). 

Files:  ctab(4). 

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