HASH(1P)
π HASH(1P) β the POSIX Programmer's Manual page, but make it make sense π
okay bestie, welcome to HASH(1P), straight outta the POSIX Programmer's Manual. pull up a chair, grab a boba, we're learning about the little shell helper that remembers where your utilities live so you don't have to π«Ά
β¨ PROLOG β¨
okay so real talk first, no cap: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ β like, go check the corresponding Linux manual page for the deets on Linux behavior β or honestly the interface might not even be implemented on Linux at all. it's giving "your mileage may vary" π
π NAME π
hash β remember or report utility locations
πΈ SYNOPSIS πΈ
hash [utility...]
hash -r
π¦ DESCRIPTION π¦
so here's the vibe: the hash utility shall affect the way the current shell environment remembers the locations of utilities found, as described in Section 2.9.1.1, Command Search and Execution.
depending on the arguments you hand it, it shall either:
- add utility locations to its list of remembered locations, or
- purge the contents of the list.
and when you pass no arguments at all? it shall report on the contents of the list. main character energy: it just tells you what it knows π
lowkey important: utilities provided as built-ins to the shell shall not be reported by hash. built-ins stay unbothered, unlisted, iconic β¨
π OPTIONS π
the hash utility shall conform to the Base Definitions volume of POSIX.1β2017, Section 12.2, Utility Syntax Guidelines.
the following option shall be supported:
-rβ forget all previously remembered utility locations. it's giving selective memory loss, on purpose, for the plot π§
π 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. β οΈ ifutilitycontains one or more<slash>characters, the results are unspecified. that's the "we don't know her" zone, bestie, don't go there π
β STDIN β
not used. she doesn't read, she only remembers π
π INPUT FILES π
none.
π ENVIRONMENT VARIABLES π
the following environment variables shall affect the execution of hash:
LANGβ provide 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 final boss of locale settings πLC_CTYPEβ determine 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β determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.NLSPATHβ determine the location of message catalogs for the processing ofLC_MESSAGES.PATHβ determine the location ofutility, as described in the Base Definitions volume of POSIX.1β2017, Chapter 8, Environment Variables.
π₯ ASYNCHRONOUS EVENTS π₯
default. nothing extra, nothing spicy, just default π«Ά
π§ 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.
this list shall consist of:
- those utilities named in previous
hashinvocations that have been invoked, and - it may contain those invoked and found through the normal command search process.
so like, sometimes she remembers the ones you told her about, and sometimes she also remembers the ones she found on her own. she contains multitudes π
πΈ STDERR πΈ
the standard error shall be used only for diagnostic messages. no casual chatting on stderr, that's not what it's for, periodt β¨
π OUTPUT FILES π
none.
π EXTENDED DESCRIPTION π
none. (she said "that's it, that's the whole thing") π
β EXIT STATUS β
the following exit values shall be returned:
0β successful completion. slay π>0β an error occurred. not slay π
π¦ CONSEQUENCES OF ERRORS π¦
default.
heads up bestie: the following sections are informative. they're lore, not law π
π APPLICATION USAGE π
since hash affects the current shell execution environment, it is always provided as a shell regular built-in. periodt.
if it is called in a separate utility execution environment, such as one of the following:
nohup hash -r
find . -type f | xargs hash
then it does not affect the command search process of the caller's environment. it's giving "she's in her own little world and the original shell didn't hear a thing" π
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.
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"
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. iykyk β¨
π EXAMPLES π
none.
π RATIONALE π
none.
π§ FUTURE DIRECTIONS π§
none.
π 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. (translation: the original is the one who decides, bestie, she holds the receipts π§Ύ)
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 little cutie came to you from IEEE/The Open Group, dated 2017 β HASH(1P), forever and always. go remember some utility locations, you absolute icon π«Άβ¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms