What is the
PATH is a list of directory paths. When the user types a command without providing the full path, this list is checked to see whether it contains a path that leads to the command. The order of paths in this variable indicates the order in which the command will be searched, in case there is a program by the same name in multiple directories the one located in the folder closest to the beginning of the list (left side) will be executed.
The reason why you got other commands blocked (from ruby rails and rvm) is because you executed this:
resulting in a
PATH that does not contain the folders of such programs, namely:
What you should do instead is add
/sbin to you own
How to add
PATH is basically always in the environment you don't need to export it, you just need to add the
/sbin directory to it. In order to do that you can execute in your bash
your path now should look something like this:
This change will not be permanent though, once your close your current session
PATH will be reloaded with the previous value. In order to make it permanent you should add this change to your
~/.profile file. One way of doing it is the following:
echo 'PATH="$PATH:/sbin"' >> ~/.profile
Now you just need to execute the content of "~/.profile" in the current shell.
You are ready to go, not only your current shell but all your future sessions will have the
PATH containing the directory.
Why did i use ~/.profile instead of ~/.bashrc?
This concept can be useful for you:
~/.profile is the place to put stuff that applies to your whole session, such as programs that you want to start when you log in (but
not graphical programs, they go into a different file), and
environment variable definitions.
~/.bashrc is the place to put stuff that applies only to bash itself, such as alias and function definitions, shell options, and
prompt settings. (You could also put key bindings there, but for
bash they normally go into ~/.inputrc.)
You cant get more information about this topic here.
Should you have
/sbin in your
I'm not going to discuss here if
/sbin should or should not be in
PATH by default because that can turn out to be not a very productive discussion to be had here. I have it, you can have it if you want. Your call.