I know there are directories like /bin
, /sbin
, /usr/bin
, /usr/local/bin
and so on, and that files in those directories can be run directly from the terminal. How does the terminal know to look at those paths?
I've heard that the paths are stored in /etc/bash.bashrc
or ~/.bashrc
, but /sbin
is not present in those files. Is there a specific file in which the paths are set, and can we add our own paths, other than using bashrc?
echo $PATH
. Then look inside of/etc/environment
file. Maybe you will make an idea./etc/environment
file, then its value can be changed in any shell initialization files.