0

I would like to force default execution to happen from my home directory.

However, regardless of what I try, it seems that the whereis utility finds programs to be in /bin instead of /home/user.

E.g. if I do

export PATH=.:$PATH

I can echo $PATH to see that this is indeed updated correctly.

However, if I now type ls, /bin/ls will still be executed. Indeed, when I look in whereis ls, I see that it finds ls in /bin/ls first, and then in /home/user/ls.

Why is that? How can I force it to use /home/user over /bin?

This is bash 4.4.12 on Debian 9.6.

  • You probably just need to clear bash's hash cache. Also, whereis, which, etc. are external programs. Use type -a or command -v etc. instead, which are builtins. – muru Jun 12 '19 at 02:51
  • @muru Well, because whereis, which, etc. are external programs, they shouldn't be affceted by bash's cache, should they? @AlphaCentauri Adding "." to PATH adds the current directory to your search path, which only equals your home directory as long as you don't cd to some other directory. – Johan Myréen Jun 12 '19 at 07:11
  • @JohanMyréen they shouldn't, and therefore they can't predict what bash will do, but bash's execution is what we're trying to fix. – muru Jun 12 '19 at 07:14
  • @muru Before you can fix bash's execution, you will have to address the more fundamental problem of why (uncached) PATH won't work, which is where the bash cache draws its information from. This question has been (yet again) too zealously marked as duplicate of something it really isn't a duplicate of. – Johan Myréen Jun 12 '19 at 07:46

0 Answers0