home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


hash

hash [-r ] [commands ]

Bourne shell version. As the shell finds commands along the search path ($PATH), it remembers the found location in an internal hash table. The next time you enter a command, the shell uses the value stored in its hash table.

With no arguments, hash lists the current hashed commands. The display shows hits (the number of times the command is called by the shell) and cost (the level of work needed to find the command). Commands that were found in a relative directory have an asterisk (* ) added in the hits column.

With commands , the shell will add those commands to the hash table.

-r removes commands from the hash list, either all of them or just the specified commands . The hash table is also cleared when PATH is assigned. Use PATH=$PATH to clear the hash table without affecting your search path. This is most useful if you have installed a new version of a command in a directory that is earlier in $PATH than the current version of the command.


Previous: Reference: getopts UNIX in a Nutshell: System V Edition Next: Reference: hash
Reference: getopts Book Index Reference: hash

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System