2 .\" Copyright 1989 AT&T Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\" This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH HASH 1 "Jul 17, 2002"
12 hash, rehash, unhash, hashstat \- evaluate the internal hash table of the
13 contents of directories
17 \fB/usr/bin/hash\fR [\fIutility\fR]
22 \fB/usr/bin/hash\fR [\fB-r\fR]
28 \fBhash\fR [\fB-r\fR] [\fIname\fR]...
50 \fBhash\fR [\fIname\fR]...
62 The \fB/usr/bin/hash\fR utility affects the way the current shell environment
63 remembers the locations of utilities found. Depending on the arguments
64 specified, it adds utility locations to its list of remembered locations or it
65 purges the contents of the list. When no arguments are specified, it reports on
66 the contents of the list. The \fB-r\fR option causes the shell to forget all
70 Utilities provided as built-ins to the shell are not reported by \fBhash\fR.
74 For each \fIname\fR, the location in the search path of the command specified
75 by \fIname\fR is determined and remembered by the shell. The \fB-r\fR option to
76 the \fBhash\fR built-in causes the shell to forget all remembered locations. If
77 no arguments are given, \fBhash\fR provides information about remembered
78 commands. The \fIHits\fR column of output is the number of times a command has
79 been invoked by the shell process. The \fICost\fR column of output is a measure
80 of the work required to locate a command in the search path. If a command is
81 found in a "relative" directory in the search path, after changing to that
82 directory, the stored location of that command is recalculated. Commands for
83 which this will be done are indicated by an asterisk (\fB*\fR) adjacent to the
84 \fIHits\fR information. \fICost\fR will be incremented when the recalculation
89 \fBrehash\fR recomputes the internal hash table of the contents of directories
90 listed in the \fBpath\fR environmental variable to account for new commands
94 \fBunhash\fR disables the internal hash table.
97 \fBhashstat\fR prints a statistics line indicating how effective the internal
98 hash table has been at locating commands (and avoiding \fBexec\fRs). An
99 \fBexec\fR is attempted for each component of the \fIpath\fR where the hash
100 function indicates a possible hit and in each component that does not begin
105 For each \fIname\fR, the location in the search path of the command specified
106 by \fIname\fR is determined and remembered by the shell. The \fB-r\fR option to
107 the \fBhash\fR built-in causes the shell to forget all remembered locations. If
108 no arguments are given, \fBhash\fR provides information about remembered
113 The following operand is supported by \fBhash\fR:
120 The name of a utility to be searched for and added to the list of remembered
127 The standard output of \fBhash\fR is used when no arguments are specified. Its
128 format is unspecified, but includes the pathname of each utility in the list of
129 remembered locations for the current shell environment. This list consists of
130 those utilities named in previous \fBhash\fR invocations that have been
131 invoked, and may contain those invoked and found through the normal command
133 .SH ENVIRONMENT VARIABLES
136 See \fBenviron\fR(5) for descriptions of the following environment variables
137 that affect the execution of \fBhash\fR: \fBLANG\fR, \fBLC_ALL\fR,
138 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
145 Determine the location of \fIutility\fR.
151 The following exit values are returned by \fBhash\fR:
158 Successful completion.
173 See \fBattributes\fR(5) for descriptions of the following attributes:
181 ATTRIBUTE TYPE ATTRIBUTE VALUE
183 Interface Stability Standard
189 \fBcsh\fR(1), \fBksh\fR(1), \fBsh\fR(1), \fBattributes\fR(5), \fBenviron\fR(5),