Where to start First steps track · 15 stages
Linux Labs

hash — Bash command path cache

cheat sheet · Ubuntu 24.04; Bash 5.2 for shell builtins https://lab.dimsanych.ru/en/wiki/hash/

Cheat sheet

  • type hash check the command kind
  • help hash builtin help
  • hash display remembered paths
  • hash -t ls show cached ls path, if present
  • hash -r clear this shell's table

Options

Without arguments, hash displays the table. -t prints the path for a remembered name, -d removes one entry, and -r clears the table. Querying an entry that has not been created can fail.

Manually binding a name to a path with -p changes command resolution and requires separate understanding. Inspection and clearing are enough for ordinary diagnostics. Use help hash for the current shell's documentation.

Loading…