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/``. .. code-block:: bash 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``: .. code-block:: bash 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: .. figure:: /_static/shell-startup.png :alt: expected shell startup :align: center :width: 400px Expected implementation Reality is ugly: .. figure:: /_static/shell-startup-actual.png :alt: actual shell startup :align: center :width: 400px 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: * See :doc:`../modules_list` for a list of all available softwares, see :doc:`modular_environment` for how to use them. However, **you can install and compile** your own versions of libraries and softwares in your ``$HOME``, or in your team shares (See :doc:`../filesystems/storages`). 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 : .. code-block:: bash export PATH=/a/new/path/to/add:$PATH * aliases The following commands should be placed on your, typically, /home/$USER/.bash_aliases file. .. code-block:: bash 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): .. code-block:: bash num() { echo $* | bc -l } * Copy a file or directory in multiple destinations (``~/.bashrc`` functions): .. code-block:: bash mcp() { echo "${*:2}" | xargs -n 1 cp $1 }