I thought, if you call a command in bash, all of the directories set in $PATH would be searched for this command.
(running as root)
$ clamscan ./
-bash: /usr/bin/clamscan: No such file or directory
There is no clamscan in /usr/bin/, but in /usr/local/bin/ (and works if i call it from there):
$ ls -hail /usr/local/bin/
62259565 drwxr-xr-x 2 root root 4.0K Jul 21 14:19 .
62259561 drwxr-xr-x 11 root root 4.0K Apr 11 19:55 ..
62260816 -rwxr-xr-x 1 root root 1.1K Jul 21 14:19 clamav-config
62260819 -rwxr-xr-x 1 root root 75K Jul 21 14:19 clambc
62260817 -rwxr-xr-x 1 root root 79K Jul 21 14:19 clamconf
62260821 -rwxr-xr-x 1 root root 141K Jul 21 14:19 clamdscan
62260823 -rwxr-xr-x 1 root root 137K Jul 21 14:19 clamdtop
62260822 -rwxr-xr-x 1 root root 95K Jul 21 14:19 clamscan
62260818 -rwxr-xr-x 1 root root 148K Jul 21 14:19 freshclam
I never changed $PATH. The directory /usr/local/bin/ is stated.
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
It could work if I copy the files from /usr/local/bin/ to /usr/bin/, but I wonder why bash seems to only ask this single directory.
Bash keeps a cache of
PATH
lookups. I surmise that you removed/usr/bin/clamscan
during the lifetime of this instance of bash, so it still has the presence of that file in its cache. Use thehash
command to rebuild the cache:hash clamscan
for just one name orhash -r
to erase the cache and start over.