1hash(1) User Commands hash(1)
2
3
4
6 hash, rehash, unhash, hashstat - evaluate the internal hash table of
7 the contents of directories
8
10 /usr/bin/hash [utility]
11
12
13 /usr/bin/hash [-r]
14
15
16 sh
17 hash [-r] [name]...
18
19
20 csh
21 rehash
22
23
24 unhash
25
26
27 hashstat
28
29
30 ksh
31 hash [name]...
32
33
34 hash [-r]
35
36
38 /usr/bin/hash
39 The /usr/bin/hash utility affects the way the current shell environment
40 remembers the locations of utilities found. Depending on the arguments
41 specified, it adds utility locations to its list of remembered loca‐
42 tions or it purges the contents of the list. When no arguments are
43 specified, it reports on the contents of the list. The -r option causes
44 the shell to forget all remembered locations.
45
46
47 Utilities provided as built-ins to the shell are not reported by hash.
48
49 sh
50 For each name, the location in the search path of the command specified
51 by name is determined and remembered by the shell. The -r option to the
52 hash built-in causes the shell to forget all remembered locations. If
53 no arguments are given, hash provides information about remembered com‐
54 mands. The Hits column of output is the number of times a command has
55 been invoked by the shell process. The Cost column of output is a mea‐
56 sure of the work required to locate a command in the search path. If a
57 command is found in a "relative" directory in the search path, after
58 changing to that directory, the stored location of that command is
59 recalculated. Commands for which this will be done are indicated by an
60 asterisk (*) adjacent to the Hits information. Cost will be incremented
61 when the recalculation is done.
62
63 csh
64 rehash recomputes the internal hash table of the contents of directo‐
65 ries listed in the path environmental variable to account for new com‐
66 mands added.
67
68
69 unhash disables the internal hash table.
70
71
72 hashstat prints a statistics line indicating how effective the internal
73 hash table has been at locating commands (and avoiding execs). An exec
74 is attempted for each component of the path where the hash function
75 indicates a possible hit and in each component that does not begin with
76 a '/'.
77
78 ksh
79 For each name, the location in the search path of the command specified
80 by name is determined and remembered by the shell. The -r option to the
81 hash built-in causes the shell to forget all remembered locations. If
82 no arguments are given, hash provides information about remembered com‐
83 mands.
84
86 The following operand is supported by hash:
87
88 utility The name of a utility to be searched for and added to the
89 list of remembered locations.
90
91
93 The standard output of hash is used when no arguments are specified.
94 Its format is unspecified, but includes the pathname of each utility in
95 the list of remembered locations for the current shell environment.
96 This list consists of those utilities named in previous hash invoca‐
97 tions that have been invoked, and may contain those invoked and found
98 through the normal command search process.
99
101 See environ(5) for descriptions of the following environment variables
102 that affect the execution of hash: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
103 and NLSPATH.
104
105 PATH Determine the location of utility.
106
107
109 The following exit values are returned by hash:
110
111 0 Successful completion.
112
113
114 >0 An error occurred.
115
116
118 See attributes(5) for descriptions of the following attributes:
119
120
121
122
123 ┌─────────────────────────────┬─────────────────────────────┐
124 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
125 ├─────────────────────────────┼─────────────────────────────┤
126 │Availability │SUNWcsu │
127 ├─────────────────────────────┼─────────────────────────────┤
128 │Interface Stability │Standard │
129 └─────────────────────────────┴─────────────────────────────┘
130
132 csh(1), ksh(1), sh(1), attributes(5), environ(5), standards(5)
133
134
135
136SunOS 5.11 17 Jul 2002 hash(1)