Hash (Unix)

Standard UNIX utility

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Hash" Unix – news · newspapers · books · scholar · JSTOR (December 2009) (Learn how and when to remove this message)

|

hashDeveloper(s)| Various open-source and commercial developers

|

Operating system| Unix, Unix-like, IBM i
Type| Command

hash is a command on Unix and Unix-like operating systems that prints the location information for the commands found. The hash command has also been ported to the IBM i operating system.[1]

## Syntax

[edit]

$ hash [name]

## Description

[edit]

When the user gives a command, the shell searches for the command in the path specified in the PATH environmental 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 implements this command in a different way.

## Options

[edit]

The following options are supported.

name
Searches the PATH environmental variable for the name given

## Exit Status

[edit]

This command returns the following exit values:

Successful completion

An Error occurred

## Examples

[edit]

$ 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

[edit]

* find
* Unix shell

* sh
* bash
* csh
* ksh

## References

[edit]

1. ^ IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). IBM. Retrieved 2020-09-05.

## External links

[edit]

The Wikibook Guide to Unix has a page on the topic of: Commands

* `hash` – Shell and Utilities Reference, The Single UNIX Specification, Version 4 from The Open Group
* `hash(1)` – Solaris 11.4 User Commands Reference Manual

* v
* t
* e

Unix command-line interface programs and shell builtins

File system|

* cat
* chattr
* chmod
* chown
* chgrp
* cksum
* cmp
* cp
* dd
* du
* df
* file
* fuser
* ln
* ls
* mkdir
* mv
* pax
* pwd
* rm
* rmdir
* split
* tee
* touch
* type
* umask

Processes|

* at
* bg
* crontab
* fg
* kill
* nice
* ps
* time

User environment|

* env
* exit
* logname
* mesg
* talk
* tput
* uname
* who
* write

Text processing|

* awk
* basename
* comm
* csplit
* cut
* diff
* dirname
* ed
* ex
* fold
* head
* iconv
* join
* m4
* more
* nl
* paste
* patch
* printf
* read
* sed
* sort
* strings
* tail
* tr
* troff
* uniq
* vi
* wc
* xargs

Shell builtins|

* alias
* cd
* echo
* test
* unset
* wait

Searching|

* find
* grep

Documentation|

* man

Software development|

* ar
* ctags
* lex
* make
* nm
* strip
* yacc

Miscellaneous|

* bc
* cal
* expr
* lp
* od
* sleep
* true and false

* Categories
* Standard Unix programs
* Unix SUS2008 utilities
* List

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template