If I run
sudo which abc I would expect it to search the superusers $PATH for the program 'abc', but it looks like it only searches a subset.
I can see this by running
sudo echo $PATH and comparing the paths searched.
$ sudo which abc which: no abc in (/sbin:/bin:/usr/sbin:/usr/bin) $ sudo echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/.local/bin:/home/ec2-user/bin
What is happening here?