Connecting to Linux with terminal emulators
Introduction
Connecting to Linux over the network from a Windows host using a terminal
emulator often results in annoying keyboard and/screen issues. You'll have some
tips & tricks about how to solve some of them.
If all else fails, or you'd really rather use Windows-based editors, an alternative
to terminal emulators is accessing files either through SSH (WinSCP)
or SMB/CIFS (Samba).
Issues
Keyboard
Navigation
Screen
- European diacritic characters
- Black & white output with Midnight Commander
Causes
- wrong $TERM
- wrong data in termcap, terminfo
- terminal emulator not 100% compatible with remote server
- OS sending UTF8 while emulator expects other character encoding
- server-side application
Investigating
Input
echo $TERM
cat -v
stty -a
stty erase '^H' (add to .profile)
^H represent BS whereas ^? represents DEL
Output
(Ubuntu) # locale
Font used in terminal emulator
Terminal Emulators
Putty
Only supports xterm
Putty Connection Manager
By default, hotkeys such as CTRL-U to duplicate the current window, are disabled:
Tools > Options > Hotkeys
Drawback: Keys used by PCM may conflict with applications (eg. F3 is also
used by Midnight Commander).
SecureCRT
Options > Session Options > Terminal > Appearance: Character Encoding
= Default -> UTF-8
Once a connection is open in one tab, File > Clone to open more without
being prompted with login/password.
Tools > Keymap Editor: If you want to map eg. CTRL+Home to CTRL+k,u (to
jump to the first line of the document in Joe), map "Ctrl-Extended-VK_HOME"
to "013\u" (\013 is octal for CTRL+k). See ASCII
Control Codes.
Why am I
seeing strange characters on the screen when I log onto RedHat, particularly
when I look at man pages?
How do get
my color scheme settings to work?
Kitty
"KiTTY is a fork from version
0.60 of PuTTY [...]. KiTTY has all the features from the original software,
and adds many others".
To tell Kitty to send ^ku and ^kv when you type CTRL+Home and CTRL-End, edit
%APPDATA%/KiTTY/kitty.ini thusly:
- [Shortcuts]
- {CONTROL}{HOME}=\x0Bu
- {CONTROL}{END}=\x0Bv
To use MidnightCommander's F7 to Search, add this to Kitty's ini file:
- print={SHIFT}{F7}
- printall={CONTROL}{SHIFT}{F7}
In addition, you should add the following lines to kitti.ini, so that Kitty
can update the Putty section in the Registry:
- [PuTTY]
- keys=load
Applications
Joe
Nano
"Meta key" = Either ALT or ESC. For instance, in Nano, on a French
keyboard layout:
- Go to the first line of the file: "M-\ or M-|" means ESC,
followed by AltGr+\ or AltGr+|
- Go to the last line of the file: "M-/ or M-?" means
ESC, followed by SHIFT+/ or SHIFT+?
Alternatively, you can customize your terminal emulator to send those keys
when typing CTRL-Home/End instead.
Ne
http://ne.dsi.unimi.it/
Vi(m)
If you get the familar ABCD's when using the arrow keys, try this:
- readlink -f $(which vi), to check whether Ubuntu is actually pointing
to vim.tiny, which "uses the /etc/vim/vimrc.tiny file instead of the
/etc/vim/vimrc file. The vimrc file sets nocompatible mode, while vimrc.tiny
does not."
- apt-get install vim
Midnight Commander
If funny characters and F10 doesn't work, try ESC 0 (zero) to close.
If connected with vt100, disconnect, use xterm, and try again.
Also check what character set the Linux server uses (eg. UTF-8), and make
sure the terminal emulator expects the same
Glossary
termcap
terminfo
readling
curses
stty
Resources
- Text-Terminal-HOWTO
by David S. Lawyer
- Linux Backspace/Delete
mini-HOWTO by Sebastiano Vigna ("there is a bottleneck between
the keyboard and console applications, that is, the fact that they can only
communicate by ASCII sequences. So special keys must be first translated
from keysyms to sequences, and then from sequences to key capabilities.
Since different consoles have different ideas about what this translation
can look like, we need a terminal database.
The system would work flawlessly,
except for a small problem: it is not always set up correctly, and not everyone
uses it. Applications must have a way to know which database entry to use:
this is accomplished by suitably setting the TERM environment variable.
In
some cases, there is a mismatch between the terminal emulator and the content
of the database entry suggested by TERM. Moreover, many applications do
not use the terminal database (or at least not all of it)"
- The
Linux keyboard and console HOWTO by Andries Brouwer
- First
Thoughts about Terminal Emulation
- Terminal emulator
- termcap
& terminfo by Linda Mui, Tim O'Reilly, John Strang (Termcap
= BSD, terminfo = System
V)
- (Putty FAQ) A.7.15
One or more function keys don't do what I expected in a server-side application
- Programmer's
Guide to NCurses by Dan Gookin
- comp.terminals
- Scan Codes Demystified
- Keyboard
scancodes by Andries Brouwer