Bash

The default shell on the cluster is bash. If you are unfamiliar with bash, an excellent resource is the Advanced Bash-Scripting Guide.

Startup scripts

When a terminal is started, various files are read and executed in order to customise the environment. Bash differentiates between three cases:

Login shells
Login shells are started when you log onto a computer using either the console or remotely via ssh. Bash reads and executes commands from the file /etc/profile (if it exists) and then reads and executes commands from the the first file that exists out of ~/.bash_profile, ~/.bash_login and ~/.profile. As explained further below, there is one exception to this rule: if you log onto the Xfce desktop, only commands in ~/.profile are executed.
Interactive shells
Interactive shells are started when you open a new shell after logging in; e.g. inside Xfce, from Emacs or from executing ‘/bin/bash’ from another terminal. Bash reads and executes commands from /etc/bash.bashrc and then ~/.bashrc (if they exist).
Non-interactive shells
When bash is started non-interactively (e.g. to run a shell script), it uses the environment variable BASH_ENV (which is not set by default) as the path to the startup script. Normally this isn’t an issue as scripts will inherit the current environment, but care must be taken when running scripts from outside login or interactive shells (e.g. via cron).

It is the difference between login and interactive shells that causes the most problems. A common solution is to place all setup commands in, say, ~/.bashrc and then include ~/.bashrc in a profile file using the source command:

$ cat ~/.profile
test -e ~/.bashrc && source ~/.bashrc

However, it is better to clearly separate out commands which only need to be executed once per session (e.g. setting environment variables) and place them in a profile file and set things like aliases in ~/.bashrc.

Xfce, dash and bash

Debian uses a minimalist shell, dash, as the default system shell. Dash is a POSIX-compliant shell but is much smaller than bash. This makes, amongst other things, bootup much faster.

A consequence for users is that when logging into Xfce, dash rather than bash is invoked as the login shell and hence only the contents of ~/.profile is executed. It is thus advisable to use ~/.profile rather than ~/.bash_profile, which is only executed when logging in directly to a terminal.

You must not include bash-only statements in your ~/.profile files.

Note that this is not the case for all Linux distributions.