I have seen the thread How to add a directory to the PATH?
I already have added the directory in my PATH by directly editing the /etc/environment
. However, I do not get the command working when I use it as
$ sudo command --options
However, things work great when I do
# command --options
or
$ command --options
Why is this the case? Also, this is not my full question. I would be thankful if someone could explain the various ways of adding directories to the path, how they work, and when is each of them in effect. How are they different?
The point of the question is not so much to get things working, but to understand how it all works. Pointing to a guide that explains this would be a great answer too.
Add it to /root/.bashrc, /etc/profile, and /etc/bash.bashrc. It should work :)
The reason is that sudo uses the /root files, and not the system-wide files (or at least, in my experience).