I have created a executable bash shell script file command. I added directory path of my custom command to $PATH variable, but whereis not showing the command path but which shows correctly. I am using bash shell with ubuntu14.04Added .local/bin to $PATH where custom command resides in .bashrcrahul@www:~$ echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/rahul/.local/bincustom command file exists and is with executable flagrahul@www:~$ ls -l .local/bin/total 8-rwxr-xr-x 1 rahul employee 79 Dec 13 15:47 customCCwhereis failing to locate the commandrahul@www:~$ whereis customCCcustomCC:which is able to find the command.rahul@www:~$ which customCC/home/rahul/.local/bin/customCCBash customCC script code#!/bin/bashcd /home/rahul/sample
why Whereis not able to show command path, while which is working correctly?
bash;path;which
whereis searches a hard-coded path, unless instructed otherwise, while which searches the PATH variable in the current environment. Please read the manual for both commands.You could use whereis with this syntax:whereis -B $HOME/.local/bin -f customCC