Refresh the cached/remembered location of commands.
Logging out and in will refresh this automatically, but if you have just updated or reinstalled a package you might want to force an update.

      hash [-lr] [-p filename] [-dt] [name]

   -p   Use filename as the full file name of the command (no path search is performed).

   -t   Print the full pathname to which each name corresponds.

   -l   Display output in a format that can be reused as input.

   -d   Forget the remembered location of each name.

   -r   Forget all remembered locations.

For each name, the full file name of the command is determined by searching the directories in $PATH and remembered.

If multiple name arguments are supplied with -t, the name is printed before the hashed full pathname. If no arguments are given, or if only -l is supplied, information about remembered commands is printed.

The return status is true unless a name is not found or an invalid option is supplied.

This is a BASH shell builtin, to display your local syntax from the bash prompt type: help hash


Display the currently remembered location for getopt:

$ getopt
$ hash -t getopt

Remove the entry for getopt:

$ hash -d getopt

“Remember me when I am gone away, Gone far away into the silent land...” ~ Christina Georgina Rossetti

Related macOS commands

history - Command History.

Copyright © 1999-2024 SS64.com
Some rights reserved