Use of the 'hash' command

hash isn't actually your history; it is a bash(1) shell built-in that maintains a hash table of recently executed programs:

Bash uses a hash table to remember the full pathnames of executable files (see hash under SHELL BUILTIN COMMANDS below). A full search of the directories in PATH is performed only if the command is not found in the hash table.

(From bash(1).)

The guide your found may have suggested running it just to see which ffmpeg command was going to be executed by the next step; perhaps there is an ffmpeg program supplied by the distribution packaging, and they wanted to make sure the new one would be executed instead of the distro-supplied one if you just typed ffmpeg at the shell.

It seems a stretch, because it would also require having the directory containing the new ffmpeg in the PATH before the distro-provided version, and there's no guarantee of that.


If you use commands that might not be installed on the system, check for their availability and tell the user what's missing. From Scripting with style

Example:

NEEDED_COMMANDS="sed awk lsof who"

missing_counter=0
for needed_command in $NEEDED_COMMANDS; do
  if ! hash "$needed_command" >/dev/null 2>&1; then
    printf "Command not found in PATH: %s\n" "$needed_command" >&2
    ((missing_counter++))
  fi
done

if ((missing_counter > 0)); then
  printf "Minimum %d commands are missing in PATH, aborting" "$missing_counter" >&2
  exit 1
fi

Tags:

Hash

Bash

Ffmpeg