FUN WITH THE C SHELL


  After months of plaguing with requests and having to keep www.tunelinux.com going as well. Me old mate Mr.Owain Vaughan has written an article especially for this site! Off you go then....!
   
  If you are not a C shell user then either discard this article or become one!

To change your shell use the chsh command and enter '/bin/csh' when prompted, then logout and back in again and you will be using the C shell from now on!

1. Filename completion
Enter 'set filec' to enable filename completion. From now on a tap of the Tab key or a double-tap of the Escape key will fill in any partially completed filename you are entering.

2. Choosing from a list of possible filename completions
If there is more than one possible completion for any given partial filename then the shell can't complete it for you, however it can give you a list! Simply press CTRL-D and you will be shown a list of possibilities. You can then go on to type the rest in yourself, or if you type in sufficient characters so as to make there only one possibility left - use Tab or double escape to finish off the job for you.

3. Recalling past commands
Enter 'set history=100' to give you a history of the past 100 commands. From now on entering 'history' will show you the last 100 commands you've entered in this shell.

You can then recall them by number or name - simply enter an exclamation mark directly followed by the number or the first few characters of the previous command you are interested in, or a double-exclamation mark for the immediately previous command.

4. Changing bits of the last command.
If you don't want to type out a whole command again because you made a typo, or because you want to execute a slightly different command you don't have to! Just use the caret (^) operator thusly:

Say you entered the command 'ls /usr/local/lib' but you really wanted 'ls /usr/local/bin', just enter '^lib^bin' and you'll get it!!

5. Making these changes permenent.
Each C shell user has a file called '.cshrc' in their home directory which contains commands that are executed when the C shell is run.
So any or all of the above tricks can be placed into your own $HOME/.cshrc file to make them C shell defaults.

Simply enter 'cat >> $HOME/.cshrc' and then paste in your favourite commands to append them to your own '.cshrc' file. Tap CTRL-D to end the file.

More to come!!

Owain