I was reading this post and trying out all of the commands in the first answer... I don't really have anything else better to do right now.
Anyways, I ran through them all in regards to rm
. What piqued my interest is this:
root@headdesk:~# type ls
ls is /bin/ls
root@headdesk:~# hash ls
root@headdesk:~# type ls
ls is hashed (/bin/ls)
root@headdesk:~#
Running help/man hash
is not very helpful, and help type
isn't really either (it does not mention hash
anywhere). Since I can't seem to find a relation in the man/info/help pages unless I am missing something, could someone please explain what hash
ing is doing in regards to the type
command?
$PATH
search is brute forced otherwise, but if it finds a command it stores its location in a hash table (supposed to be, anyway) so it can call it up next time. if you doPATH=$PATH
orhash -r
it will forget all executables in the hash table. it doesnt usually affect anything, but it can make a difference for weird lookup tables compiled out of a list of empty files in the current directory, for instance. it used to make things a lot faster, but i dunno if its so true anymore. maybe if$PATH
is huge,... – mikeserv Dec 27 '15 at 06:38