High-Performance Computing at the NIH

RSS Feed
Startup Files on the Helix Systems

Bash

The standard shell on Helix 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.

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).

When you logout, the file .bash_logout is interpreted.

You can list your startup files using the command ls -a.

Some examples of defaults you can set in your .bash_profile file:

  • Setting your default printer. Your .bash_profile file should say (with [printer] replaced with your default printer):

    export PRINTER=[printer]
  • Setting your path:

    PATH=$PATH:$HOME/bin

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

# Don't alert on every new email:
unset MAILCHECK

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

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

# Automatically load a commonly used application module:
module load python/2.7.6

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. 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:

  • Setting your default printer:

    setenv PRINTER [printer]
  • Setting your path:

    set PATH = ( $PATH $HOME/bin )

Others

Other shells available are sh, ksh, and zsh. See here for more information.