# Hash (Unix)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Hash_(Unix)
> Markdown URL: https://mediated.wiki/source/Hash_(Unix).md
> Source: https://en.wikipedia.org/wiki/Hash_(Unix)
> Source revision: 1353624087
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Standard UNIX utility}}
{{refimprove|date=December 2009}}
{{Lowercase title}}
{{Infobox software
| name                   = hash
| logo                   = 
| screenshot             = 
| screenshot size        = 
| caption                = 
| author                 = 
| developer              = Various [open-source](/source/open-source_software) and [commercial](/source/commercial_software) developers
| released               = 
| latest release version = 
| latest release date    = 
| operating system       = [Unix](/source/Unix), [Unix-like](/source/Unix-like), [IBM i](/source/IBM_i)
| genre                  = [Command](/source/Command_(computing))
| license                = 
| website                = 
}}

'''hash''' is a [command](/source/command_(computing)) on [Unix](/source/Unix) and [Unix-like](/source/Unix-like) [operating system](/source/operating_system)s that prints the location information for the commands found. The {{kbd|hash}} command has also been ported to the [IBM i](/source/IBM_i) operating system.<ref>{{cite web |title=IBM System i Version 7.2 Programming Qshell |language=en |author=IBM |website=[IBM](/source/IBM) |author-link=IBM |url=https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzahz/rzahzpdf.pdf?view=kc |access-date=2020-09-05 }}</ref>

==Syntax==
 $ hash [name]

==Description==
When the user gives a command, the shell searches for the command in the path specified in the [PATH environmental variable](/source/PATH_(variable)) and stores the location in the hash. This command can be used to search for the command given. The command is built into the shell. [C shell](/source/C_shell) implements this command in a different way.

==Options==
The following options are supported.
 
;name: Searches the PATH environmental variable for the name given

==Exit Status==
This command returns the following exit values:

;0: Successful  completion 

;1: An Error occurred

==Examples==
 $ hash

Print the hash table.

 $ hash cat

Searches for command cat in the path specified by PATH environmental variable; if found, adds it to the hash.

==See also==
* [find](/source/Find_(Unix))
* [Unix shell](/source/Unix_shell) {{unordered list| [sh](/source/Bourne_shell) | [bash](/source/Bash_(Unix_shell)) | [csh](/source/C_shell) | | [ksh](/source/kornShell) }}

==References==
{{Reflist}}

==External links==
{{Wikibooks|Guide to Unix|Commands}}
* {{man|cu|hash}}
* {{man|1|hash|Solaris}}

{{Unix commands}}

Category:Unix SUS2008 utilities
Category:IBM i Qshell commands

---
Adapted from the Wikipedia article [Hash (Unix)](https://en.wikipedia.org/wiki/Hash_(Unix)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Hash_(Unix)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
