100 Useful Command-Line Utilities
by Oliver; 2014103. Bonus: Global Variables
To see all global variables, type:$ setWhere bash looks for commands and scripts:
$PATHAdd a directory path to the back of the path:
$ PATH=$PATH:/my/new/pathAdd a directory path to the front of the path:
$ PATH=/my/new/path:$PATHNow we know where to put bash commands, but what about other programs? What if you've installed a package or a module in a local directory and you want the program to have access to it? In that case, the following global variables come into play.
Where matlab looks for commands and scripts:
$MATLABPATHWhere R looks for packages:
$R_LIBSWhere awk looks for commands and scripts:
$AWKPATHWhere Python looks for modules:
$PYTHONPATHWhere Cpp looks for libraries:
$LD_LIBRARY_PATHWhere Perl looks for modules:
$PERL5LIBThis will come into play when you've locally installed a module and have to make sure Perl sees it. Then you'll probably have to export it. E.g.:
$ export PERL5LIB=/some/path/lib64/perl5Text editor:
$EDITORYou can set this by typing, e.g.:
export EDITOR=/usr/bin/nanoThen Control-x-e will invoke the text editor.
The specially designated temporary directory:
$TMPDIRA shell variable that stores a random number for you:
$RANDOMFor example:
$ echo $RANDOM 1284 $ echo $RANDOM 27837