Environment Setup
Blaz Jesenko heeft deze pagina aangepast 3 jaren geleden

Environment Variables

Environment variables are named strings available to all applications. Variables are used to adapt each application's behavior to the environment it is running in. You might define paths for files, language options, and so on. You can see each application's manual to see what variables are used by that application.

That said, there are several standard variables in Linux environments:

PATH = Colon separated list of directories to search for commands.
HOME = Current user's home directory.
SHELL = The user's preferred shell.
EDITOR = The user's preferred text editor.

You can add a folder and its executables to your path.

export PATH=/home/blaz/myprograms/:${PATH}

If /home/$(whoami)/bin exists, it is allready added to your path.

.bashrc & .profile

From "man bash"

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

*This means:*

  • Set your environmental variables in your .profile file.
  • Consider sourcing all of your environmental modifications from a separate file
  • Source your env. modifications after the "Interactivity check" (after the "# If not running interactively, don't do anything" section)
  • If you plan to run something non-interactively do not forget to load your environmental modification file.

add following to the end of your ~/.profile file:

if [ $(dnsdomainname) = "olimp-cluster" ]; then
         source ~/olimp.sh
fi

Modify following file as you seem fit: cat ~/olimp.sh

#listing aliases
alias lt='ls -ltrs'
alias ll='ls -Flh'
alias llt='ls -Flth'
alias llr='ls -Flrth'

#other aliases
alias scratch='cd /scratch/blaz/work'
alias utar='tar -xzvf'
alias ctar='tar -czvf'
#slurm aliases
alias findmyjob=" sacct --allusers -X -S 010121 -n -p --format JobIDRaw,User,JobName,NNodes,Partition,NodeList,State,ExitCode,Elapsed |grep blaz |grep $1" 

#source a bunch of stuff for normal compiling etc...
source /opt/intel/bin/compilervars.sh -arch intel64 -platform linux 
source /opt/Wolfram/mathematica.sh
source /opt/matlab/matlab.sh