hash (Unix)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

hash is a Unix command that prints the location information for the commands found.

Syntax[edit]

ksh: 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:

0 Successful completion

1 An Error occurred

Examples[edit]

1. hash

Print the hash table.

2. hash cat

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

See also[edit]

The bash command, csh command, find command, ksh command, sh command.