Hash (Unix)

From Wikipedia, the free encyclopedia

The correct title of this article is hash. The initial letter is shown capitalized due to technical restrictions.

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

Contents

[edit] Syntax

ksh: hash [name]

[edit] Description

When the user gives a command, the shell searchs for the command in the path specified in the PATH environental variable and stores the location in the hash. This command can be used to search for the command given. The command is build-in to the shell. csh shell implements this command in the different way.

[edit] Options

The following options are supported

name Searchs the PATH environmental variable for the name given

[edit] Exit Status

This command returns the following exit values:

0 Successful completion

1 An Error occurred

[edit] Examples

1. hash

Print the hash table.

2. hash cat

Searchs for command cat in the path specified by PATH environmental variable, if found addes it to the hash.

[edit] File

/usr/bin/hash contains the hash command.

[edit] See also

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