Compute Canada

How do I setup my shell?

Please note: The FAQ pages at the HPCVL website are continuously being revised. Some pages might pertain to an older configuration of the system. Please let us know if you encounter problems or inaccuracies, and we will correct the entries.

To a large degree, your shell is set up using a tool called usepackage. This allows you to replace the setting of several environment variables, and the execution of setup scripts by a simple command of the form use package, where package stands for a pre-defined application or feature that you want to include in your setup. We discuss the use of use in the next section.

On a lower level, there are several setup files in your home directory. Depending on the shell you use, these files differ in their structure and command syntax. If you are a new user of our systems, the system will copy a set of default files into your home directory. If you need setup files for a shell other than your login shell, or you are not a new user, but want to set yourself up from scratch, the default files can be found in /etc/skel. Check out the README file in that directory.

For csh there are two basic setup files: .cshrc and .login. The former gets "sourced" (i.e. applied to the shell) every time you call a shell, while the latter only applies to login shells. Due to the leading "." these files are not visible if you type "ls"; you will have to type "ls -la" to see them. Editing this file lets you change the basic behavior of your shell. If you don't have any setup files in your account, our system will apply a simple default setup that lets you access system functions, compile code, run parallel programs, and use our scheduling software. Note that there may be other setup files. csh sources the .login file when you log in, and the .logout file when you log out. All these files reside in your home directory.

For ksh the main setup file is called .profile. It is also "invisible". If you don't have it in your directory, your shell will still be set up "reasonably" by our system. You can also obtain a default .profile from /etc/skel.

Since bash uses a similar scripting syntax as ksh, it can execute .profile on login as well. Other setup files for bash are .bashrc and .bash_profile which have a similar function for bash as .cshrc and .login do for csh. For details about which files are sourced in which order, consult the man pages: man bash or equivalent. As for the other shells, bash setup files may be obtained from /etc/skel.

The setup files are mainly used to set environment variables such as PATH, and to execute a few commands when the shell is started. Note that all shells first execute a default setup script, and therefore have default values for the most common variables. You can check the current values of all environment variables by typing "env".