Content


Abstract

This file contains several shell scripts that allow various interesting customizations of your user environment. The aliases file contains a list of aliases that I personally find useful. The files bash_shell and tcsh_shell contain commands that modify the shell behavior and environment. Finally, the file settitle contains functions and aliases that will dynamically update the title bar of your dtterm or xterm window with the full path of your current working directory.


How to Use These Files

In order to use these files directly, you must first be using either tcsh or bash as your command interpreter shell. Since csh is the default and supported shell for your CNS computing id (used both on GPU and on the cad machines in CEB 531), I'd recommend that you use tcsh. Tcsh has the same command syntax as csh, but has an enriched feature set, including a command-line editor, filename and word completion, and a more customizable environment. It also has the advantage of compatibility with csh, so all of the environmental configurations that you are currently using will continue to work.
Bash, in my opinion, is the better shell, but I do not believe it is officially supported by CNS. Thus, their online documentation uses tcsh and csh syntax, and has to be adapted for use with bash. However, bash does seem to be configured correctly (it can find maxplus2, anyhow... :-) ). Also, a note to computer engineers: bash is more popular among computer science students, since it is the default shell for Linux, and is thus a lot better supported on Computer Science machines.
In any event, you can use either shell. I've provided nearly equivalent sets of files for each shell, and provide instructions for how to painlessly use these files. If you don't know what shell you are using, or are not using tcsh or bash, then refer to the next section, Changing your Shell and then follow the directions below. Finally, note that these script files can be used for all of your computer accounts: your CNS account (on GPU and the cad stations...configure separately, since each has a different home directory), your EE account (on nyquist and the HP machines in CEB 540), and your CS account (on ohaton, obed, the cab machines, the gsb machines, etc).

Using the Files under tcsh

  1. Get the file tcsh_configs.tar.gz and copy it to your home directory.
  2. Unzip it with the command gunzip tcsh_configs.tar.gz.
  3. Untar it with the command tar xvf tcsh_configs.tar. This will create the directory .tcsh_configs which contains the three script files.
  4. If you don't have a file named .tcshrc in your home directory, create it with the following contents:
    source ~/.cshrc
    source ~/.tcsh_configs/aliases
    source ~/.tcsh_configs/tcsh_shell
    source ~/.tcsh_configs/settitle
    You can leave out some lines if you decide that you don't want to use those files after all. If you do have the file .tcshrc, then just add the last three lines shown above to the end of that file.

Using the Files under bash

  1. Get the file bash_configs.tar.gz and copy it to your home directory.
  2. Unzip it with the command gunzip bash_configs.tar.gz.
  3. Untar it with the command tar xvf bash_configs.tar. This will create the directory .bash_configs which contains the three script files.
  4. You should have a file named .bashrc in your home directory. If you don't, you will have to obtain the standard copy of it from the system-dependant location. Contact the lab administrator or ask one of your peers. When you get it, add the following lines to the end:
    source ~/.bash_configs/aliases
    source ~/.bash_configs/bash_shell
    source ~/.bash_configs/settitle
    You can leave out some lines if you decide that you don't want to use those files after all.

Changing your Shell

The method for changing your shell, unfortunately, is a system-dependant process. Here, I will only give instructions for changing your CNS login shell, which will affect the shell you use for both GPU and the cad lab. Other methods involve the chsh and passwd -s commands. Ask your sysadmin or your peers if you cannot figure out how to change the shell on other systems.

In order to determine what shell you are using, you can do one of two things.

  1. Type echo $SHELL. This environment variable should be set to the name of the shell you are using.
  2. Type cat /etc/passwd | grep youruid, where youruid is your user id for that system. The output should be your entry from the system password file, which should list your shell in the last field.
  3. Type ps to bring up a list of your running processes. Your shell will be listed here.
To change your shell for your CNS computing id (used for GPU and the cad labs), follow the following steps:
  1. Telnet on to gpu.srv.ualberta.ca
  2. Type chsh youruid where youruid is your user id for that system. You will be asked to enter your password.
  3. You will then be presented with a list of shells, and will be told your default login shell and your current shell. You will be prompted to answer whether you want to change your shell. Enter y.
  4. You will then be prompted to choose a shell from the list given. Type in the full path for the shell you want and hit return.
  5. You're done! It will take at most one day for the change to become permanent (since CNS schedules shell changes for security reasons, I'd imagine). In order to use your shell immediately, just type tcsh or bash at your prompt. This will start another shell process within your current shell. In fact, you could do this at any time to test out the different shells for a bit.


Shell Modifications

Aliases are user-defined command names that allow you to use less keystrokes for commonly used commands. For example, aliasing lsl to ls -lF means that typing lsl at the prompt is equivalent to executing the ls -lF command. Examine the file in order to view the aliases that I have defined. Feel free to add, delete, and change them as you see fit. Aliases are very much a matter of personal preference. :-)

The files tcsh_shell and bash_shell contain shell customization commands. I'm not going to explain them all, since they are all described in great detail in the man pages for the shells. Furthermore, there are many other options that I did not customize that you might wish to. Perhaps the best example of this is the prompt variable, which is highly customizable. I prefer the form "gargus@cad10:(cwd)$ ", since it lists who I am logged on as (useful when you have several user ids on that machine, such as root access, or a course account), what machine I am logged on to (useful when having several sessions to different machines open), and the immediate working directory I am in (relying on settile to give me my full path). Again, these customizations are very much a matter of personal preference, and are well documented in the man pages.

The settitle file contains the specific customization that communicates with terminal windows to dynamically change their titles as you change your current directory. In tcsh, this is accomplished by aliasing the command cwdcmd, which is a special shell command that gets executed everytime the current working directory. In bash, the same effect is accomplished by defining a shell function named settitle that is called after commands that change the current working directories. In order to disable the dynamic title changes, merely unalias the cwdcmd or override the function definition of settitle with a function that has no body.


The Files

Here are the files:
bash_configs.tar.gz (2421 bytes)
tcsh_configs.tar.gz (1130 bytes)


Other Resources

More information on the settings can be found in the extensive shell online documentations, which can be obtained by typing man tcsh and man bash, depending on which shell you are using. These are the best resources and references to describe the above modifications.


Feedback

Please feel free to submit comments, questions, and feedback in general on this topic to the address shown at the bottom of the page. I will answer your questions and update this document to improve its overall clarity and utility.


Maintainer: Javan Gargus, <javan@cs.ualberta.ca>
Last Update: 11:34 on Monday, Oct 5, 1998