Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active April 2, 2023 09:39
Show Gist options
  • Save miguelmota/bb7f8587047c7dcb5fe38b41ba2d357d to your computer and use it in GitHub Desktop.
Save miguelmota/bb7f8587047c7dcb5fe38b41ba2d357d to your computer and use it in GitHub Desktop.
Bash `which` vs `type`

which vs type

  • which

    • finds executable in your $PATH
    • lives in /usr/bin/which
  • type

    • determines if command is alias, function, built-in command, cached executable (hashed), binary in $PATH, etc
    • shell builtin
@jlguenego
Copy link

You can use hash -r to remove the cached executable. So which and type will resync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment