HASH(1POSIX)
๐ธ HASH(1POSIX) โ the POSIX Programmer's Manual, bestie edition ๐ธ
okay so before we even get into it, a lil heads-up from the manual itself:
๐ข PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details on Linux behavior), or the interface may not even be implemented on Linux at all. ๐ so like, vibe check your platform first, bestie.
โจ NAME โจ
hash โ remember or report utility locations ๐ง โจ
๐ SYNOPSIS ๐
hash [utility...]
hash -r
๐ DESCRIPTION ๐
okay so the hash utility is gonna affect the way the current shell environment remembers where utilities were found, exactly as described in Section 2.9.1.1, Command Search and Execution. Depending on what arguments you hand it, it's either adding utility locations to its list of remembered locations, or it's straight-up purging the whole list. ๐งน
And when you give it no arguments at all? It reports on the contents of the list. Like, "here's what I remember, queen." ๐
๐จ important: utilities that are provided as built-ins to the shell shall not be reported by hash. They're built in, they don't need a lil address book entry, iykyk.
โจ OPTIONS โจ
The hash utility shall conform to the Base Definitions volume of POSIX.1โ2017, Section 12.2, Utility Syntax Guidelines. slay, standards.
The following option shall be supported:
-rโ forget all previously remembered utility locations. memory? wiped. ๐งฝ it's giving factory reset.
๐ฆ OPERANDS ๐ฆ
The following operand shall be supported:
utilityโ the name of a utility to be searched for and added to the list of remembered locations. โ ๏ธ but ifutilitycontains one or more<slash>characters, the results are unspecified. like, we don't know her, we can't speak on her. ๐
๐ STDIN ๐
Not used. she doesn't read. ๐
๐ INPUT FILES ๐
None. nothing coming in.
๐ ENVIRONMENT VARIABLES ๐
The following environment variables shall affect the execution of hash:
LANGโ provides a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1โ2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)LC_ALLโ if set to a non-empty string value, override the values of all the other internationalization variables. she's the main character, periodt.LC_CTYPEโ determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).LC_MESSAGESโ determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error.NLSPATHโ determines the location of message catalogs for the processing ofLC_MESSAGES.PATHโ determines the location ofutility, as described in the Base Definitions volume of POSIX.1โ2017, Chapter 8, Environment Variables.
โก ASYNCHRONOUS EVENTS โก
Default. nothing special happening here.
๐ฌ STDOUT ๐ฌ
The standard output of hash shall be used when no arguments are specified. Its format is unspecified, but it includes the pathname of each utility in the list of remembered locations for the current shell environment. ๐
That list shall consist of those utilities named in previous hash invocations that have been invoked, and may contain those invoked and found through the normal command search process. so like, it's a mix, bestie.
๐ญ STDERR ๐ญ
The standard error shall be used only for diagnostic messages. that's its whole job.
๐ OUTPUT FILES ๐
None. we're not writing files here.
๐ง EXTENDED DESCRIPTION ๐ง
None. there is no extended description. she said what she said. โ
๐ฅ EXIT STATUS ๐ฅ
The following exit values shall be returned:
0โ successful completion. ate. ๐>0โ an error occurred. ๐ญ something went wrong.
๐ CONSEQUENCES OF ERRORS ๐
Default.
The following sections are informative. (translation: the tea below is context, not requirements, bestie ๐ซ)
๐ซถ APPLICATION USAGE ๐ซถ
Since hash affects the current shell execution environment, it is always provided as a shell regular built-in. ๐ so if you call it in a separate utility execution environment โ like one of these:
nohup hash -r
find . -type f | xargs hash
โฆthen it does not affect the command search process of the caller's environment. like, you did all that in a whole different room and nobody in the group chat heard it. ๐
The hash utility may be implemented as an alias โ for example, alias -t - โ in which case utilities found through normal command search are not listed by the hash command. sneaky.
The effects of hash -r can also be achieved portably by resetting the value of PATH; in the simplest form, this can be:
PATH="$PATH"
like, iconic little trick. ๐ช
The use of hash with utility names is unnecessary for most applications, but may provide a performance improvement on a few implementations; normally, the hashing process is included by default anyway. so like, don't stress. ๐
๐ EXAMPLES ๐
None. no examples in the source, so no examples from me. we stay honest. โจ
๐ง RATIONALE ๐ง
None. the reasoning is a mystery even to me. ๐
๐ฎ FUTURE DIRECTIONS ๐ฎ
None. the future is unwritten, bestie. ๐ฆ
๐ SEE ALSO ๐
- Section 2.9.1.1, Command Search and Execution
- The Base Definitions volume of POSIX.1โ2017, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines
โญ COPYRIGHT โญ
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version 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 .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
๐ and that's the whole page, bestie. this one's brought to you by IEEE/The Open Group, 2017 โHASH(1POSIX), that's the manual page we just devoured, and yes she is iconic. go forth andhash -rresponsibly. mwah. ๐โจ๐ฆ๐
๐ฆ where this page comes from
- debian bookworm: manpages-posix 2017a-2 ยท Other
- debian trixie: manpages-posix 2017a-2 ยท Other
- ubuntu jammy: manpages-posix 2017a-2 ยท Other
- ubuntu noble: manpages-posix 2017a-2 ยท Other
- ubuntu resolute: manpages-posix 2017a-2build1 ยท Other
- ubuntu stonking: manpages-posix 2017a-2.1 ยท Other
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms