[mandelbrot
set] MATH DEPT Computer News, Volume 29

How to update your login shell from csh to tcsh

If you, like me, have had an account on the Math network of SUNs since the days of Wyse 50 terminals, chances are your login shell is still set to be csh instead of the new and improved tcsh that new users get by default these days.

I recently changed my login shell to tcsh and have become so powerful and efficient at the UNIX prompt that it scares me. I explain below how you can do likewise.

First, let me assure you that you will cause yourself no stress by upgrading your shell to tcsh. The commands of the old csh are a subset of the new tcsh and you can have the new shell, but continue your same old behavior at the the UNIX prompt, and not notice the change. Also, your old .cshrc file will continue to work just fine, so any aliases you have created over the years will continue to work. But, if you ever type a few commands in tcsh and decide you want to rerun a variant of a previous command, you can now push the UP arrow on your keyboard and see old commands scroll by in reverse order. When you see the one you want to rerun, you can even use the LEFT arrow to go back into the command and edit it by using the BACKSPACE key and inputting new text by just typing it in. When it is all fixed and ready to go, just push RETURN and it will run. (That's the main reason I wanted the upgrade, after I saw more savy users doing things like this before my eyes that I had never dreamed possible.)

If you'd like to experiment with tcsh before switching to it, just type

tcsh

at a UNIX prompt. You'll get a new prompt, but you won't notice a change until you type an UP arrow. When you are done experimenting with tcsh, just type

exit

at the prompt and you'll be back in your old csh.

One minor difference between csh and tcsh that I got used to very quickly is that you push TAB instead of ESC to complete file names. For example, in the old csh, if I had a file called transcendental.tex, I could type only

amstex tra

and then push ESC and the rest of the filename would suddenly appear:

amstex transcendental.tex

and I would push RETURN and run the command. In tcsh, I need to push TAB in place of ESC to do the same thing.

I learned lots of little tidbits about the new tcsh shell in very short order by consulting the web page

http://www.tcsh.org

But, to learn enough to become powerful and efficient beyond my wildest imaginings, I got my hands on the O'Reilly handbook Using csh & tcsh by Paul DuBois.

If you want to see who is in the know and who isn't, type

finger bell

to see that user bell is using tcsh instead of csh:

Login name: bell                        In real life: Steven R Bell
Directory: /homes/bell                  Shell: /usr/bin/tcsh

I bet lipshitz is a csh man.

You can also check to see what shell you are using by typing

set | grep -i shell

To take the simple steps needed to change your shell to tcsh, just type the following command while logged on to any math machine:

passwd -r ldap -e

You will be prompted to enter your current password. After you do that, you will be asked to enter the path to a "New Shell." Type

/bin/tcsh

Then log off and log back in and you'll have a new shell. Now, every time you log in, you will have the tcsh shell. (If you want to change back to csh at some point, repeat this process and type /bin/csh for your new shell.)

If you update your .cshrc at the same time that you switch to tcsh, you might need to make some small changes to your new .cshrc file to make things work the way you are used to. For example, you might need to change the lines that make your default printer lpub9 to some other printer, and you might need to change your umask. See UNIX for math related information about UNIX and filemodes for an explanation of UNIX filemodes and your umask setting.

If you have an antique .login file, I've been told that you can just delete it after you update your .cshrc to the latest version. That fixed a bug or two for me.

See http://www.math.purdue.edu/resources/computing/faq for more information about other shells (like bash) that can be chosen. (bash is very much like tcsh, with the only drawback that you will have to deal with conflicts between your .cshrc file and a .bash file that you will have to create.)

One last word about an advanced feature. On our system, tcsh uses emacs style key bindings by default for editing the command line. I wanted to use vi style key bindings instead because I am a vi master of the 6th level. An easy way to get this feature is to add the line

bindkey -v

to your .login file, or better yet, to add the lines

if ($?tcsh) then
bindkey -v
endif

to your .cshrc file instead.

Imagine the feeling of typing

!?tex?:gs/paper1/paper2/

to rerun an old command

amstex paper1 ; dvips -Pweb paper1 ; distill paper1.ps ; rm paper1.ps

that you ran twenty lines ago, but with paper2 in place of paper1. Ah... that's nice.

NOTE: This page is rather outdated. The new Linux servers support the commands pdflatex and pdftex that create a PDF file directly from the TeX source file. If you run TeX to create a DVI file, you can then run dvipdf, which will create a PDF file from the DVI file. There is also ps2pdf that will convert a PostScript file to PDF.


Back to the Network News Index Page

Back to the MATH 2000 HOME PAGE