Startup Files

Bash

The standard shell on Helix and Biowulf is bash. Under bash when you log in, the operating system creates a login shell for you. This shell looks in your home directory for your .bash_profile file and follows the instructions it finds in this file:

$ cat /home/$USER/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

Another startup file .bashrc is only for interactive non-login shells (such as when start another shell, or get allocated nodes on the Biowulf cluster):

$ cat /home/$USER/.bashrc
# cat .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions

When you logout, the file .bash_logout is interpreted.

You can list your startup files using the command ls -al:

$ ls -al /home/$USER
drwx------.   16 user     user      12288 Jan 26 12:56 .
drwxr-xr-x. 3477 root     root     274432 Jan 31 16:22 ..
-rw-------.    1 user     user       4040 Jan 31 15:10 .bash_history_biowulf
-rw-r--r--.    1 user     user         18 Nov 24  2021 .bash_logout
-rw-r--r--.    1 user     user        193 Nov 24  2021 .bash_profile
-rw-r--r--.    1 user     user        281 Dec 28 09:54 .bashrc
drwx------.    2 user     user       4096 Dec 28 19:30 .ssh
-rw-------.    1 user     user        112 Jan 26 12:56 .Xauthority

Editing your startup files

A simple way of editing your startup files is with nano:

$ nano /home/$USER/.bashrc

Simplify Simplify Simplify

Because there are two startup files that are sourced under different circumstances, it is best to only maintain one file, and use the other as a pass-through. We recommend that your .bash_profile look like this:

# .bash_profile

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

With .bash_profile acting as a pass-through, all your environment settings should be placed in .bashrc:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
  . /etc/bashrc
fi

# Add your own bin directory to your path:
if [ -d $HOME/bin ]; then
  PATH=$HOME/bin:$PATH
fi

# Set a nice prompt:
export PS1='[\u@\h \W]$ '

# Create an alias to a GUI editor:
alias scite='SciTE'

Do NOT pre-load modules

Because application modules can sometimes result in an error, and others are not allowed to be loaded on the login node, pre-loading modules in your startup files is a very bad idea. If there is an error, you will be prevented from logging in. Additionally, there are sometimes collisions between application libraries and other login processes.

Do not include things like this:

module load python/3.6
source /data/user/conda/etc/profile.d/conda.sh

Set your umask

Your umask defines the default set of access permissions to place on new files and directories.

By default it is set to 027, which allows members of the group read and execute only, and all others no access. For users with shared data directories, it is sometimes advantageous to set it to 007, which allows members of the group full read, write, and execute permission:

umask 007

Configuring The Command Line Editing Interface

Bash supports a sophisticated and configurable command line interface, allowing control over command history, directory display, and keyboard bindings, among others. This interface can be configured manually using the set, shopt, and bind commands. The startup file .inputrc can be edited to make changes to the configuration permanent. Here is an example .inputrc file:

# .inputrc

# Turn off that stupid bell
set bell-style none

# Add a slash to the end of directories for tab completion
set mark-directories on

# Make symlinked directories look just like regular directories
set mark-symlinked-directories on

# Don't automatically expand tilde on word completion
set expand-tilde off

# Append a character to a file name denoting its type
set visible-stats on

# Don't show files that start with '.' in tab completion
set match-hidden-files off

For more information about command line editing and the Readline library, see http://www.gnu.org/software/bash/manual/html_node/Command-Line-Editing.html#Command-Line-Editing.

To display your current settings, type these commands:

set -o
shopt
bind -V

Tcsh/Csh

Another shell is csh, and its fancy derivative tcsh. On Helix & Biowulf, we highly recommend that all users use the bash shell. However, if you are determined to use csh/tcsh, see below.

Under csh, .cshrc is first interpreted (under tcsh, the OS will look for .tcshrc first, then .cshrc). The OS will then look for .login. Upon logging out, it will look for .logout.

The same commands above in bash are translated to tcsh/csh and would be placed in .cshrc:

# .cshrc

# Source global definitions
source /etc/csh.cshrc

# Setting your path
set PATH = ( $PATH $HOME/bin )

# Set a nice prompt
set prompt = "%n@%m %~ %% "

# Create an alias to a GUI editor
alias scite 'SciTE'

Others

Other shells available are sh, ksh, and zsh. We provide very limited support for these shells.