"export CDPATH=/usr", like this I want to manipulate CDPATH environment variable. Then I can't be sure it is the same as before when I put "export CDPATH=." on the command line and enter. So, I want to know where this CDPATH variable goes. Where do I confirm the changes of variable in a file?? Furthermore, where are all the environment variables go in Ubuntu?? Are they go to the all the same file or all different files? Thanks for reading.
11 Answer
The environment variable $CDPATH sets a path which tells the cd command where to search for its destination directories.
For example if you set CDPATH=$HOME, you can cd to any subdirectory of $HOME from wherever you are. Setting CDPATH=. doesn't make much sense as the current directory is always considered the starting point for cd. If you always want a certain value for $CDPATH you should set it in any of the files bash reads when it starts : ~/.bashrc, ~/.profile, etc. Take a look at the many questions as to where define $PATH.