Skip to content

Customising your bash profile for ease and efficiency

Rowena Hill edited this page Feb 21, 2025 · 3 revisions

Setting up your ~/.bash_profile

A customised bash profile can help make your personal experience of using the HPC easier and more efficient.

It is controlled by a hidden file in your home directory named ~/.bash_profile. The . at the beginning of the filename makes it invisible to a normal ls, but ls -al will show you all invisible files in a directory. ~/.bash_profile is automatically loaded when you log into the HPC and any preferences you set within it are applied to your shell environment.

One of the most useful applications of a bash profile is to set shortcuts for commands you commonly use. This can be done with alias, which allows you to attribute some command to a single word of your choosing. For instance, if you are frequently navigating to a specific project area, you can add the following line to ~/.bash_profile to avoid having to type out the whole path every time:

alias myproject='cd /ei/projects/pathtoyourprojectarea/'

Then you only have to type myproject to navigate to that directory.

If you don't already have a ~/.bash_profile file, you can create one with nano ~/.bash_profile. Here's a basic starter template you might want to use:

alias data='cd /ei/projects/pathtoyourprojectarea/'
alias scratch='cd /ei/.project-scratch/pathtoyourscratcharea/'

Then you can simply add a new line for each feature you add. There are endless customisations you can make. For instance, you can set up a quick shortcut to viewing what jobs you personally have running on the queue:

alias jobs='squeue -u username'

Have a search online for inspiration to optimise your ~/.bash_profile. After editing ~/.bash_profile always remember to log out and back in to the HPC for the changes to take effect.

Clone this wiki locally