[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 6

whereis Command

Purpose

Locates source, binary, or manual for program.

Syntax

whereis-s ] [  -b ] [  -m ] [  -u ] [ { {  -S -B -M Directory ... }...  -f ] File ... 

Description

The whereis command locates the source, binary, and manuals sections for specified files. The supplied names are first stripped of leading path name components and any (single) trailing extension of the form .ext (for example, .c). Prefixes of s. resulting from use of the Source Code Control System (see SCCS) are also dealt with. The command then attempts to find the desired program from a list of standard locations.

A usage message is returned if a bad option is entered. In other cases, no diagnostics are provided.

Flags

If any of the -b, -s, -m or -u flags are given, the whereis command searches only for binary, source, manual, or unusual sections respectively (or any two thereof).

-b Searches for binary sections of a file.
-m Searches for manual sections of a file.
-s Searches for source sections of a file.
-u Searches for unusual files. A file is said to be unusual if it does not have one entry of each requested type. Entering whereis -m -u * asks for those files in the current directory which have no documentation.

The -B, -M, and -S flags can be used to change or otherwise limit the places where the whereis command searches. Since the program uses the chdir subroutine to run faster, path names given with the -M, -S and -B flag directory list must be full; for example, they must begin with a / (slash).

-B Like -b, but adds a directory to search. Change or limit the places where the whereis command searches for binaries.
-M Like -m, but adds a directory to search. Change or limit the places where the whereis command searches for manual sections.
-S Like -s, but adds a directory to search. Change or limit the places where the whereis command searches for sources
-f Terminates the last -M, -S or -B directory list and signal the start of file names.

Examples

To find all of the files in the /usr/ucb directory that either are not documented in the /usr/man/man1 directory or do not have source in the /usr/src/cmd directory, enter:

cd /usr/ucb
whereis -u -M /usr/man/man1 -S /usr/src/cmd -f *

Files

/usr/share/man/* Directories containing manual files.
/sbin, /etc, /usr/{lib,bin,ucb,lpp}
                          Directories containing binary files.
/usr/src/* Directories containing source code files.

Related Information

The chdir subroutine.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]