Shells Available for CS Accounts (bash, tcsh, etc.)

In Linux (and other Unixes), the shell is the program that provides a command line for you to type in commands and programs to run. We have a number of shells available on our systems.

For accounts created before August 2018, the default shell was tcsh. Since August 2018, the default shell has been bash.


Shells Available on CS Linux Clients

The following shells are available on the CS Linux clients:

  • bash
  • tcsh
  • zsh
  • csh

How to Tell What Shell You're Using

At a command line, run the following command:

echo $0

It will print the name of the shell you're currently using. In some circumstances, it might print a dash before the shell name. You can just ignore the dash.

How to Change Your Shell

On a CS Linux client, run the following command:


When prompted for a new shell, you must type the full path to the shell.

  • For grad net accounts, put "/bin/" in front of the shell name. (e.g. /bin/bash)
  • For ugrad net accounts, put "/usr/local/bin/" in front of the shell name. (e.g. /usr/local/bin/zsh)
    • It will take about fifteen minutes before all of our ugrad Linux clients see the change. If you log in to any of them immediately afterwards (before they've had time to get the update), you'll probably still be using your old shell.

Setting Shell Variables

There are a number of environment variables that affect how your shell operates, especially $PATH, which tells the shell where to look for programs. The way to change shell variables differs between bourne family shells (e.g. bash) and c-shell family shells (e.g. tcsh).

Let's say we want to add the ~/bin directory to the front of our $PATH.

In bash, that would be:

export PATH="~/bin:$PATH"

In tcsh, that would be:

setenv PATH "~/bin:$PATH"

Shell Aliases

The syntax for aliases is only slightly different between bash and tcsh.

Let's say you have a ~/courses/cs220/assignments directory that you access a lot. You can make a command to quickly go to that directory no matter where your are at the moment. Let's say you want to call the command "cs220".

In bash, you'd do this:

alias cs220='cd ~/courses/cs220/assignments/'

In tcsh, you'd do this:

alias cs220 'cd ~/courses/cs220/assignments/'

(Notice that there is no = in the tcsh example.)

Configuration Files

If you want to save aliases or shell configurations to use every time you log in, you need to put them in a shell configuration file.

bash will use one of two files, depending on how it was started.

  • If it was started directly after logging in to the system, bash will use ~/.bash_profile .
  • Otherwise, bash will use ~/.bashrc .

We recommend putting the following line into ~/.bash_profile and then using ~/.bashrc for all of your configurations:

source ~/.bashrc

tcsh will use ~/.tcshrc .