[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 6

which Command

Purpose

Locates a program file, including aliases and paths.

Syntax

whichName ... ]

Description

The which command takes a list of program names and looks for the files that run when these names are given as commands. The which command expands each argument, if it is aliased, and searches for it along the user's path. The aliases and paths are taken from the .cshrc file in the user's home directory. If the .cshrc file does not exist, or if the path is not defined in the .cshrc file, the which command uses the path defined in the user's environment.

A diagnostic is given if a name is aliased to more than a single word or if an executable file with the argument name is not found in the path.

In the Korn shell, you can use the whence command to produce a more verbose report. See "Korn Shell Special Commands" in AIX Version 4.3 System User's Guide: Operating System and Devices for more information on the whence command.

Examples

To find the executable file associated with a command name of lookup :

which lookup

Files

$HOME/.cshrc Contains the source of aliases and path values.

Related Information

The csh command, find command, file command, ksh command, sh command, whereis command.

Shells Overview in AIX Version 4.3 System User's Guide: Operating System and Devices describes shells, the different types, and how they affect the way commands are interpreted.

Commands Overview in AIX Version 4.3 System User's Guide: Operating System and Devices.


[ Previous | Next | Contents | Glossary | Home | Search ]