hash(1)
NAME
hash, rehash, unhash, hashstat − shell built-in functions to evaluate the internal hash table of the contents of directories
SYNOPSIS
sh
hash [ −r ] [ name ... ]
csh
rehash
unhash
hashstat
ksh
hash
DESCRIPTION
sh
For each name, the location in the search path of the command specified by name is determined and remembered by the shell. The −r option to the hash built-in causes the shell to forget all remembered locations. If no arguments are given, hash provides information about remembered commands. Hits is the number of times a command has been invoked by the shell process. Cost is a measure of the work required to locate a command in the search path. If a command is found in a "relative" directory in the search path, after changing to that directory, the stored location of that command is recalculated. Commands for which this will be done are indicated by an asterisk (∗) adjacent to the Hits information. Cost will be incremented when the recalculation is done.
csh
rehash recomputes the internal hash table of the contents of directories listed in the path environmental variable to account for new commands added.
unhash disables the internal hash table.
hashstat prints a statistics line indicating how effective the internal hash table has been at locating commands (and avoiding execs). An exec is attempted for each component of the path where the hash function indicates a possible hit and in each component that does not begin with a ‘/’.
ksh
hash provides information about remembered commands. In the first column of the output, Hits, is the number of times a command has been invoked by the shell process. In the second column, Cost, is a measure of the work required to locate a command in the search path. The third column lists the command. If a command is found in a "relative" directory in the search path, after changing to that directory, the stored location of that command is recalculated. Commands for which this will be done are indicated by an asterisk (∗) adjacent to the Hits information. Cost will be incremented when the recalculation is done.
SEE ALSO
SunOS 5.4 — Last change: 15 Apr 1994