[Next] [Previous] [Up] [Top] [Contents] [Index]
Chapter 2: Getting Started on a UNIX System
Like all systems, UNIX has a number of special keys that perform particular functions. Some important ones are the keys necessary to backspace over a character when entering a command, to delete the whole line being entered, and to interrupt execution. These are user-specifiable, and have different defaults based on the shell, the version of UNIX, and the login files described in section 9.4. If you are using the Fermi files (most UNIX systems at Fermilab have FUE installed and thus do use these files), these special keys will be set as described in the table:
Name | Control Char | Function |
|---|---|---|
erase | Erase character. Backspace and erase one character (the key used depends on terminal setting). Sometimes, especially within tcl/tk applications, you must use <Ctrl-h>. | |
werase | Delete the rightmost word typed in. | |
kill | Kill (erase) the line typed in so far.[8] | |
intr | Interrupt the program currently running. | |
rprnt | Reprint the line typed in so far. | |
flush | Stops terminal output until you press a key. | |
susp | Suspend the program currently running and put it in the background. This does not stop the process as it does in VMS! | |
stop | Stop the display. To resume, press the start key | |
start | Start the display after stop. | |
eof | Send the program an end-of-file character. |
To display the current settings for your terminal, enter:
% stty -a
If the keys don't seem to work as described here or you want to change them, refer to section 9.7.
UNIX relies on the hardware tabs of your terminal. If they are not set or if they are set in an unusual way, displays may appear strange on your terminal. You can set the tabs manually on your terminal, or you can use the tabs command to set them. The command with no arguments:
% tabs
will set tabs in the usual UNIX way, 8 spaces apart.
In some unusual circumstances of setup and keyboards you may also need to issue this set of commands to get the backspace key to work as expected:
% stty erase "^?" % stty intr "^C" % stty kill "^X"
Sometimes there is trouble with the delete key. Adding the following text to your .profile or .login will make the key useful, even on X terminals from different places on different platforms:
case $TERM in
vt100)
stty erase \^? ;;
xterm)
case "`xdpyinfo | grep 'vendor string'`" in
*DigitalEquipmentCorp*) stty erase \^? ;;
*Network\ Computing\ Devices*) stty erase \^H ;;
*Silicon\ Graphics*) stty erase \^H ;;
*) stty erase \^H ;;
esac
;;
esac
To make the up and down arrow keys work and therefore to enable command line editing and recall in ksh, include the following lines in your .shrc file (or .kshrc):
set -o emacs
alias __A='^P'
alias __D='^B'
alias __B='^N'
alias __C='^F'
Note that the A, D, B, and C are preceded by two underscores, and that you need to insert an actual control character, not simply carat-P or carat-B. A control character typically needs to be preceded by a "quoting" character, which differs from editor to editor.
... enter this immediately before the control character:
<Ctrl-v>
<Ctrl-q>
<Ctrl-v> <Ctrl-v>
<Ctrl-[>
Use Insert Control Character from the Edit menu.
We believe this prescription works on all UNIX operating systems, regardless of how you're connected (e.g., telnet, xterm).
#stty kill '^u' in your .login file (C shell family), or #stty kill in your .profile file (Bourne shell family).