hash
Shell built-in command path cache manager
TLDR
Show command hash table
SYNOPSIS
hash [options] [name...]
DESCRIPTION
hash is a shell built-in command that manages the hash table of recently executed commands. The shell uses this table to cache the full filesystem paths of commands, avoiding repeated searches through the PATH directories.
When a command is first executed, the shell locates it by searching each directory in PATH. The resolved path is then stored in the hash table so subsequent invocations skip the search entirely, improving performance.
The hash table can become stale if commands are moved, renamed, or if new versions are installed in higher-priority PATH directories. Running `hash -r` clears the table, forcing the shell to re-resolve paths on next use. This is commonly needed after installing new software or modifying PATH.
PARAMETERS
-r
Clear hash table.-p path name
Add path for name.-d name
Delete name from hash.-t name
Print path for name.-l
List in reusable format.
CAVEATS
Shell built-in; behavior varies by shell. Hash becomes stale if commands move. Use hash -r after PATH changes or software installation. Only affects current shell session.
HISTORY
The hash command has been part of Unix shells since the Bourne shell. It provides manual control over the command path caching mechanism that shells use for performance.
