Skip to content

Note

bash is the only officially supported shell for the HPCC

Linux shells

A Unix/Linux shell is a command-line interpreter which provides a user interface for the Unix/Linux operating system. Users control the operation of a computer by submitting single commands or by submitting one or more commands via a shell script. Several common shell choices are available on HPCC:

  • bash: a Bourne-shell (sh) compatible shell with many newer advanced features as well
  • tcsh: an advanced variant on csh with all the features of modern shells
  • zsh: an advanced shell which incorprates all the functionality of bash, tcsh, and ksh combined
  • csh: the original C-style shell

The default shell provided to HPCC users is the bash shell. To change your shell, please contact HPCC support. To find out your current shell run echo $SHELL.

Environment variables

Environment variables are a set of dynamically named values which can control the way running processes will behave on a computer. Many of the Unix commands and tools require certain environment variables to be set. Many of these are set automatically for the users when they log in or load applications via the module command.

To view your current set of environment variables run env.

To assign a new value to an environment variable in either bash or zsh: export <name>=<value>

To assign a new value to an environment variable in either tcsh or csh: setenv <name> <value>

To print the value of a variable: echo $<name>

Commonly used environment variables

Bash variables are preceded with $ and optionally enclosed in brackets when used e.g. $USER or ${USER}.

  • $HOSTNAME: Name of the computer currently running the shell or script. If used in a SLURM job, this should be one of the nodes listed in the variable $SLURM_JOB_NODELIST
  • $USER: User's name (NetID). Useful if you would like to dynamically generate a directory on some scratch space.
  • $HOME: User's home directory. Can also use ~/ symbol.
  • $SCRATCH: Your folder on the scratch disk.
  • $TMPDIR: Temporary working folder of a running job at /mnt/local/$SLURM_JOBID.

To see all variables in the context of your job, add this line to your job script, which will list all variables that contain the word 'SLURM'

1
$ env | grep SLURM

Startup scripts

A startup script is a shell script which the login process executes. It provides an opportunity to alter your environment. You are free to setup your own startup scripts but be careful to make sure they are set up correctly for both interactive and batch access or it may negatively affect your ability to log in or run batch jobs on the system. Below are startup scripts for each shell:

  • bash: ~/.bashrc
  • tcsh: ~/.chsrc
  • zsh: ~/.zshrc
  • csh: ~/.cshrc