I’m working on a small app based on ffmpeg, and I read a tutorial made for ubuntu where they advise to use the command hash on the produced executable.
I’m curious about that command, did you ever use it? For which purpose?
When I run it in my source folder, I get this (once compiled)
$ hash
hits command
1 /usr/bin/strip
1 /usr/local/bin/ffmpeg
1 /usr/bin/svn
4 /usr/local/bin/brew
2 /usr/bin/git
1 /bin/rm
1 /bin/cat
1 /usr/bin/ld
1 /bin/sh
4 /usr/bin/man
5 /usr/bin/make
4 /usr/bin/otool
15 /bin/ls
6 /usr/bin/open
2 /usr/bin/clear
Looks like a summary of my bash_history…
When I run it on an executable file, I do not have lots of lines displayed, and nothing seems to changes in that application ?
$ md5 ffserver
MD5 (ffserver) = 2beac612e5efd6ee4a827ae0893ee338
$ hash ffserver
$ md5 ffserver
MD5 (ffserver) = 2beac612e5efd6ee4a827ae0893ee338
When I look for the man, it just says it’s a builtin function. Really useful 🙂
It does work (let say exist) on Linux and on MacOSX.
hashisn’t actually your history; it is abash(1)shell built-in that maintains a hash table of recently executed programs:(From
bash(1).)The guide your found may have suggested running it just to see which
ffmpegcommand was going to be executed by the next step; perhaps there is anffmpegprogram 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 typedffmpegat the shell.It seems a stretch, because it would also require having the directory containing the new
ffmpegin thePATHbefore the distro-provided version, and there’s no guarantee of that.