BASH Configuration

On the DGX servers, the home and data directories are shared amongst the machines. Every user has a set bash shell (/usr/bin/mysecureshell) with basic configurations. There are a couple of useful things available to do that can make using that shell more comfortable.

Prompts

The bash prompts can be changed to one’s liking. There are 6 more or less relevant variables that influence the look and feel of the shell: PS0, PS1, PS2, PS3, PS4, PROMPT_COMMAND. Read about their meanings in the Wiki. By default, the PS1 is set to "\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ " (read about the meaning of the flags, the colors are achieved with ANSI escape sequences), which will make the prompt look like this:

Basic bash prompt theme

In order to get more information from the system, the following two lines can be added at the end of ~/.bashrc:

More advanced prompt customization.
PS1="${SLURM_JOBID+\033[1m[\033[33m${SLURM_JOB_NAME}\033[39m:\033[93m${SLURM_JOBID}\033[39m]\033[21m}\[\033[35;1m\]\t\[\033[39m\]-\[\033[36m\]\u\[\033[39m\]@\[\033[32m\]\h\033[39m\]:\[\033[34m\]\w\[\033[39m\]\$\033[m "
PS2="\[\033[39;1m\]>\033[m "

Which will look like this:

Advanced bash prompt theme

Note that it clearly indicates whether the shell is inside a running slurm job or not, and includes the slurm job name and the job id.