Merge commit 'dc97a43d4a70c8773a619f11b95b07a787f6f5b7' into merges
[unleashed.git] / share / man / man1 / hash.1
blob15c9f6c07e8d73804b8abc07560b8172dc23017c
1 '\" te
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"
11 .SH NAME
12 hash, rehash, unhash, hashstat \- evaluate the internal hash table of the
13 contents of directories
14 .SH SYNOPSIS
15 .LP
16 .nf
17 \fB/usr/bin/hash\fR [\fIutility\fR]
18 .fi
20 .LP
21 .nf
22 \fB/usr/bin/hash\fR [\fB-r\fR]
23 .fi
25 .SS "sh"
26 .LP
27 .nf
28 \fBhash\fR [\fB-r\fR] [\fIname\fR]...
29 .fi
31 .SS "csh"
32 .LP
33 .nf
34 \fBrehash\fR
35 .fi
37 .LP
38 .nf
39 \fBunhash\fR
40 .fi
42 .LP
43 .nf
44 \fBhashstat\fR
45 .fi
47 .SS "ksh"
48 .LP
49 .nf
50 \fBhash\fR [\fIname\fR]...
51 .fi
53 .LP
54 .nf
55 \fBhash\fR [\fB-r\fR]
56 .fi
58 .SH DESCRIPTION
59 .SS "/usr/bin/hash"
60 .sp
61 .LP
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
67 remembered locations.
68 .sp
69 .LP
70 Utilities provided as built-ins to the shell are not reported by \fBhash\fR.
71 .SS "sh"
72 .sp
73 .LP
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
85 is done.
86 .SS "csh"
87 .sp
88 .LP
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
91 added.
92 .sp
93 .LP
94 \fBunhash\fR disables the internal hash table.
95 .sp
96 .LP
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
101 with a '\|/\|'.
102 .SS "ksh"
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
109 commands.
110 .SH OPERANDS
113 The following operand is supported by \fBhash\fR:
115 .ne 2
117 \fB\fIutility\fR \fR
119 .RS 12n
120 The name of a utility to be searched for and added to the list of remembered
121 locations.
124 .SH OUTPUT
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
132 search process.
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.
140 .ne 2
142 \fB\fBPATH\fR \fR
144 .RS 9n
145 Determine the location of \fIutility\fR.
148 .SH EXIT STATUS
151 The following exit values are returned by \fBhash\fR:
153 .ne 2
155 \fB\fB0\fR \fR
157 .RS 7n
158 Successful completion.
162 .ne 2
164 \fB\fB>0\fR \fR
166 .RS 7n
167 An error occurred.
170 .SH ATTRIBUTES
173 See \fBattributes\fR(5) for descriptions of the following attributes:
178 box;
179 c | c
180 l | l .
181 ATTRIBUTE TYPE  ATTRIBUTE VALUE
183 Interface Stability     Standard
186 .SH SEE ALSO
189 \fBcsh\fR(1), \fBksh\fR(1), \fBsh\fR(1), \fBattributes\fR(5), \fBenviron\fR(5),
190 \fBstandards\fR(5)