0

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 ubuntu 14.04

Added .local/bin to $PATH where custom command resides in .bashrc

~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/rahul/.local/bin

custom command file exists and is with executable flag

~$ ls -l .local/bin/
total 8
-rwxr-xr-x 1 rahul employee 79 Dec 13 15:47 customCC

whereis failing to locate the command

~$ whereis customCC
customCC:

which is able to find the command.

~$ which customCC
/home/rahul/.local/bin/customCC

Bash customCC script code

#!/bin/bash
cd /home/rahul/sample

1 Answers1

1

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
fd0
  • 1,449