<< 2011-2 >>
Department of
Computer Science
 

Customising Unix

In Unix, it is customary to do a lot of typing rather than using GUIs, with windows used mainly as a way of doing several things at once. It is a fact that, in most situations, if you are used to it, you can work faster by typing than by using GUIs. Unix is streamlined for this kind of development, with excellent support for customisation, automation, multi-tasking and cooperation for those who know what they are doing. For this reason, a lot of serious developers use a Unix environment even for developing PC Windows programs.

Shell: It is worth checking what shell you use, and consider switching to a better one. The standard shell on Linux is usually bash, which is fine. The default on some other Unix systems is csh which is not very good. Try commands such as echo $SHELL or man -k shell or man csh or man bash to find out more for yourself. To change your shell from csh to bash, edit the .cshrc file in your home directory. Add a last line containing the command exec bash. Then set up your preferences for the new shell in the file called .bashrc in your home directory.

The two most important extra shell features are editing and completion. Editing gives you the ability to use the arrow keys to edit the current command line, or to go back through the session history to find a previous command to edit and reissue. For example, to repeat the last command you typed in, you only have to press the up arrow key and then the enter key. The csh shell has only a crude version of this using the ! character.

Completion gives you the ability to complete command names or file names automatically by pressing the tab key. This saves typing, without using mouse-based cut-and-paste, which tends to slow you down a lot. The csh shell has a version of this feature, but it is switched off by default, and uses the escape key rather than the tab key.

Tools: There is a huge range of tools available as standard unix commands, and as programs which can be installed. For example, you should check out commands such as make, find, grep, which, du, bg, jobs, ...

Editor: Editors are very personal things, and difficult to change once you have got used to them. You need to make a choice which will last you a long time. One reasonable platform independent choice is jedit.

Whatever editor you use, you should customise it to use soft tabs rather than hard tabs (ie make the TAB key insert spaces rather than explicit tab characters), to insert a newline at the end of the last line of every file, and to prevent files wider than 80 columns being created. This is essential for creating platform-independent text files which will not irritate readers of your code (eg markers!).

© 1995-2012 University of Bristol  |  Terms and Conditions
About this Page