Basic Environment

You can define or modify your shell environment by editing ~/.profile, ~/.bashrc and ~/.bash_aliases. Some examples/skeletons are available at /applis/PSMN/debian11/skeletons/.

cp /applis/PSMN/debian11/skeletons/profile ~/.profile
cp /applis/PSMN/debian11/skeletons/bashrc ~/.bashrc

You may have to reconnect to take changes into account or source your modified file.

You can define your own aliases in ~/.bash_aliases:

cp /applis/PSMN/debian11/skeletons/bash_aliases ~/.bash_aliases
vi ~/.bash_aliases
source ~/.bash_aliases
aliases  # should show your new aliases

Important

You may need to be aware of the order in cascading configuration files. It should be something like that:

expected shell startup

Fig. 31 Expected implementation

Reality is ugly:

actual shell startup

Fig. 32 Actual implementation

Source blog post

Finding softwares

A large number of common utilities, libraries and softwares are already installed, either directly on the system:

  • search in /usr/bin/, /usr/lib/ and /usr/lib/x86_64-linux-gnu/

or by PSMN Staff:

However, you can install and compile your own versions of libraries and softwares in your $HOME, or in your team shares (See Where to store files?).

Bash tips & tricks

  • Make sure that your PATH includes /bin and /usr/bin. That is, when you need to add a new path to $PATH, define it as follows :

export PATH=/a/new/path/to/add:$PATH
  • aliases

The following commands should be placed on your, typically, /home/$USER/.bash_aliases file.

alias l='ls -lF'      # Use long form and classify filetypes (one of */=>@|)
alias la='ls -alF'    # Show hidden files, dot-files
alias lh='ls -lFh'    # Human-readable file sizes
alias lt='ls -lFt'    # sort by time
alias ll='ls -alFth'  # all above :)

alias du1='du -h -d1 .'

alias hgrep='history | grep '  # grep from the bash history

alias pending='squeue --me --states=PENDING --sort=S,Q --format="%.10i %.12P %.8j %.8u %.6D %.4C %.20R %Q %.19S" '  # my pending jobs
alias running='squeue --me --states=RUNNING --format="%.10i %.12P %.8j %.8u %.2t %.10M %.6D %.4C %R %.19e" '  # my running jobs
  • Perform mathematical computation in shell (~/.bashrc functions):

num()
{
    echo $* | bc -l
}
  • Copy a file or directory in multiple destinations (~/.bashrc functions):

mcp()
{
    echo "${*:2}" | xargs -n 1 cp $1
}