Remember that Unix evolved in a time when many manufacturers made many different models of computer terminals, each with its own set of command codes for clearing the screen, moving the cursor to different screen positions, setting bold face, underline and other text characteristics, and so on. A typical Unix installation will be equipped to communicate with any of a few hundred different types of terminals.
Now, you're not using a terminal, but you are using a program that
simulates one. telnet
was originally intended to allow
terminals to issue commands to remote CPUs, and ssh
is
intended as a replacement for the older telnet
protocol, so
your ssh client program actually works by simulating an
“old-fashioned” computer terminal. The authors of your client
program chose one or more kinds of terminal that they would simulate. For
Unix to manipulate your screen appropriately, it most know what kind of
terminal command codes your ssh client program is prepared to
accept.
Find out the kind of terminal being emulated by your telnet program. You may need to consult the program documentation or help files for this. You may also be able to deduce this information from the program's “Options” or “Preferences” menus.
Here are some common choices:
SSH client program | TERM type | Comments |
---|---|---|
PuTTY | xterm | |
OpenSSH | xterm? | (Need to check this) |
Command-line SSH, basic form, Linux or OS/X | xterm or Linux | |
Command-line SSH, basic form, CygWin | xterm or rxvt | Depends on what type of window you type the command in. |
Command-line SSH, xterm variant
|
xterm |
Look at the messages that you received after logging in. If it includes a line saying something like “Terminal type is…” and the terminal type that it names makes sense for your ssh client program, you're all set and you can skip the next step. But if the terminal type seems wrong, or you see a message indicating that you are on a “dumb terminal” [6], you need to tell the Unix system what kind of terminal you are really emulating. The command to do so is
setenv TERM xxxx
where xxxx is the kind of terminal
(e.g, setenv TERM vt100
).
Most “dumb” terminals provide for 24 lines of text. Your ssh connection may have defaulted to this, but most Unix systems will allow their terminals to provide a larger text area. If you choose to use a larger text area, you should tell Unix how many lines you are using by giving the command
stty rows nn
where nn is the number of rows/lines.
[6] A dumb terminal is one that displays lines of text but has no command codes for moving things to specific locations on the screen or doing other basic operations. Many Unix applications, such as text editors, will not work with dumb terminals.