hash
shell built-in that manages the hash table of recently executed commands
TLDR
Show command hash table
SYNOPSIS
hash [options] [name...]
DESCRIPTION
hash is a shell built-in that manages the hash table of recently executed commands. The shell uses this table to remember the full paths of commands, avoiding repeated PATH searches.
When a command is executed, the shell stores its path in the hash table. Subsequent invocations use the cached path, improving performance.
hash
# Clear after installing new software
hash -r
# Check where a command is hashed
hash -t python
# List all hashed commands
hash -l
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.
