1 The Linux keyboard and console HOWTO
2 Andries Brouwer, aeb@cwi.nl
5 This note contains some information about the Linux keyboard and con-
6 sole, and the use of non-ASCII characters. It describes Linux 2.0.
7 ______________________________________________________________________
69 2. Keyboard generalities
71 3. Console generalities
73 4. Resetting your terminal
75 4.1 Keyboard hardware reset
77 5. Delete and Backspace
79 5.1 How to tell Unix what character you want to use to delete the last typed character
80 5.1.1 `Getty used to do the right thing with DEL and BS but is broken now?'
81 5.1.2 `Login behaves differently at the first and second login attempts?'
82 5.2 How to tell Linux what code to generate when a key is pressed
83 5.2.1 `How do I get a dvorak keyboard?'
84 5.2.2 `Why doesn't the Backspace key generate BackSpace by default?'
85 5.3 How to tell X to interchange Delete and Backspace
86 5.4 How to tell emacs what to do when it receives a Delete or Backspace
87 5.5 How to tell emacs to interchange Delete and Backspace
88 5.6 How to tell kermit to interchange Delete and Backspace
89 5.7 How to tell xterm to interchange Delete and Backspace
90 5.8 How to tell xterm about your favourite tty modes
91 5.9 How to tell xmosaic that the Backspace key generates a DEL
92 5.10 A better solution for Motif-using programs, like netscape
93 5.11 What about termcap and terminfo?
94 5.12 A complete solution
96 6. The console character sets
100 7.1 Changing the number of Virtual Consoles
102 8. Ctrl-Alt-Del and other special key combinations
104 8.1 Ctrl-Alt-Del (Boot)
105 8.2 Other combinations
107 8.4 Dosemu Combinations
108 8.5 Composing symbols
111 9. How to get out of raw mode
113 10. The keyboard LEDs
115 11. The TERM variable
119 12. How to make other programs work with non-ASCII chars
123 13.1 What precisely does XFree86-2.1 do when it initializes its keymap?
125 14. Unusual keys and keyboards
127 15. Examples of use of loadkeys and xmodmap
129 15.1 `I can use only one finger to type with'
131 16. Changing the video mode
133 16.1 Instructions for the use of resizecons
135 17. Changing the keyboard repeat rate
143 21. Some properties of the VT100 - application key mode
145 22. Hardware incompatibility
151 ______________________________________________________________________
153 1
\b1.
\b. U
\bUs
\bse
\bef
\bfu
\bul
\bl p
\bpr
\bro
\bog
\bgr
\bra
\bam
\bms
\bs
156 The following packages contain keyboard or console related programs.
158 kbd-1.00.tar.gz contains loadkeys, dumpkeys, showkey, setmetamode,
159 setleds, setfont, showfont, mapscrn, kbd_mode, kbdrate, loadunimap,
160 chvt, resizecons, deallocvt, getkeycodes, setkeycodes. It also
161 contains openvt, formerly called open.
163 SVGATextMode-1.8.tar.gz contains SVGATextMode, a program that
164 obsoletes resizecons.
166 util-linux-2.9 contains setterm, kbdrate.
168 sh-utils-1.12 contains stty.
170 See also dynamic-vc-1.1.tar.gz and consd-1.1.tgz for programs that
171 exploit the `Keyboard Signal' key. Very primitive versions are
172 spawn_login or spawn_console found in the kbd package.
174 See font.tgz for a package that handles console fonts.
177 The X distribution contains xmodmap, xset, kbd_mode. (See also
178 X386keybd(1) for the situation under XFree86 1.3, and Xserver(1) for
179 the XKEYBOARD extension under X11R6.) A handy interface to xmodmap is
180 xkeycaps, see http://www.jwz.org/xkeycaps/.
182 termcap-2.0.8.tar.gz contains termcap, an old terminal capabilities
183 data base. ncurses-1.9.9e.tar.gz contains the termlib data base which
184 obsoletes termcap. (However, there are still many programs using
187 See loadkeys(1), setleds(1) and setmetamode(1) for the codes generated
188 by the various keys and the setting of leds when not under X. Under X,
189 see xmodmap(1) and xset(1).
191 See setfont(8) for loading console fonts. Many people will want to
192 load a font like iso01.f16 because the default font is the hardware
193 font of the video card, and often is a `Code Page 437' font missing
194 accented characters and other Latin-1 symbols.
196 See setterm(1) and kbdrate(8) for properties such as foreground and
197 background colors, screen blanking and character repeat rate when not
198 under X. Under X, see xset(1), also for key click and bell volume.
199 The file /etc/termcap defines the escape sequences used by many
200 programs addressing the console (or any other terminal). See
201 termcap(5). A more modern version is found in /usr/lib/terminfo. See
202 terminfo(5). Terminfo files are compiled by the terminfo compiler
203 /usr/lib/terminfo/tic, see tic(1). Their contents can be examined
204 using the program infocmp, see infocmp(1).
206 The Linux console sequences are documented in console_codes(4).
211 2
\b2.
\b. K
\bKe
\bey
\byb
\bbo
\boa
\bar
\brd
\bd g
\bge
\ben
\bne
\ber
\bra
\bal
\bli
\bit
\bti
\bie
\bes
\bs
214 You press a key, and the keyboard controller sends scancodes to the
215 kernel keyboard driver. Some keyboards can be programmed, but usually
216 the scancodes corresponding to your keys are fixed. The kernel
217 keyboard driver just transmits whatever it receives to the application
218 program when it is in _
\bs_
\bc_
\ba_
\bn_
\bc_
\bo_
\bd_
\be _
\bm_
\bo_
\bd_
\be, like when X is running.
219 Otherwise, it parses the stream of scancodes into keycodes,
220 corresponding to key press or key release events. (A single key press
221 can generate up to 6 scancodes.) These keycodes are transmitted to
222 the application program when it is in _
\bk_
\be_
\by_
\bc_
\bo_
\bd_
\be _
\bm_
\bo_
\bd_
\be (as used, for
223 example, by showkey). Otherwise, these keycodes are looked up in the
224 keymap, and the character or string found there is transmitted to the
225 application, or the action described there is performed. (For
226 example, if one presses and releases the a key, then the keyboard
227 produces scancodes 0x1e and 0x9e, this is converted to keycodes 30 and
228 158, and then transmitted as 0141, the ASCII or latin-1 code for `a';
229 if one presses and releases Delete, then the keyboard produces
230 scancodes 0xe0 0x53 0xe0 0xd3, these are converted to keycodes 111 and
231 239, and then transmitted as the 4-symbol sequence ESC [ 3 ~, all
232 assuming a US keyboard and a default keymap. An example of a key
233 combination to which an action is assigned is Ctrl-Alt-Del.)
235 The translation between unusual scancodes and keycodes can be set
236 using the utility setkeycodes - only very few people will need it.
237 The translation between keycodes and characters or strings or actions,
238 that is, the keymap, is set using the utilities loadkeys and
239 setmetamode. For details, see getkeycodes(8), setkeycodes(8),
240 dumpkeys(1), loadkeys(1), setmetamode(1). The format of the files
241 output by dumpkeys and read by loadkeys is described in keymaps(5).
243 Where it says `transmitted to the application' in the above
244 description, this really means `transmitted to the terminal driver'.
245 That is, further processing is just like that of text that comes in
246 over a serial line. The details of this processing are set by the
250 3
\b3.
\b. C
\bCo
\bon
\bns
\bso
\bol
\ble
\be g
\bge
\ben
\bne
\ber
\bra
\bal
\bli
\bit
\bti
\bie
\bes
\bs
253 Conversely, when you output something to the console, it first
254 undergoes the standard tty processing, and then is fed to the console
255 driver. The console driver emulates a VT100, and parses the input in
256 order to recognize VT100 escape sequences (for cursor movement, clear
257 screen, etc.). The characters that are not part of an escape sequence
258 are first converted into Unicode, using one of four mapping tables if
259 the console was not in UTF-8 mode to start with, then looked up in the
260 table describing the correspondence between Unicode values and font
261 positions, and the obtained 8- or 9-bit font indices are then written
262 to video memory, where they cause the display of character shapes
263 found in the video card's character ROM. One can load one's own fonts
264 into character ROM using setfont, load the corresponding Unicode map
265 with loadunimap, and load a user mapping table using mapscrn. More
266 details will be given below.
268 There are many consoles (called _
\bV_
\bi_
\br_
\bt_
\bu_
\ba_
\bl _
\bC_
\bo_
\bn_
\bs_
\bo_
\bl_
\be_
\bs or _
\bV_
\bi_
\br_
\bt_
\bu_
\ba_
\bl _
\bT_
\be_
\br_
\bm_
\bi_
\bn_
\ba_
\bl_
\bs,
269 abbreviated VCs or VTs) that share the same screen. You can use them
270 as independent devices, either to run indendent login sessions, or
271 just to send some output to, perhaps from top, or the tail of the
272 system log or so. See below (`Console switching') on how to set them
273 up and switch between them.
277 4
\b4.
\b. R
\bRe
\bes
\bse
\bet
\btt
\bti
\bin
\bng
\bg y
\byo
\bou
\bur
\br t
\bte
\ber
\brm
\bmi
\bin
\bna
\bal
\bl
280 There is garbage on the screen, or all your keystrokes are echoed as
281 line drawing characters. What to do?
283 Many programs will redraw the screen when Ctrl-L is typed. This might
284 help when there is some modem noise or broadcast message on your
285 screen. The command clear will clear the screen.
287 The command reset will reset the console driver. This helps when the
288 screen is full of funny graphic characters, and also if it is reduced
289 to the bottom line. If you don't have this command, or if it does
290 something else, make your own by putting the following two lines in an
291 executable file reset in your PATH:
300 that is, you want to send the two characters ESC c to the console.
302 Why is it that the display sometimes gets confused and gives you a
303 24-line or 1-line screen, instead of the usual 25 lines? Well, the
304 main culprit is the use of TERM=vt100 (or some other entry with 24
305 lines) instead of TERM=linux when logged in remotely. If this happens
306 on /dev/tty2 then typing
316 on some other VT (where 4 symbols are typed to cat: ESC, c, ENTER,
317 Ctrl-D) and refreshing the screen on /dev/tty2 (perhaps using Ctrl-L)
318 will fix things. Of course the permanent fix is to use the right term-
319 cap or terminfo entry.
321 Why is it that you sometimes get a lot of line-drawing characters,
322 e.g., after catting a binary to the screen? Well, there are various
323 character set changing escape sequences, and by accident your binary
324 might contain some of these. The ESC c is a general reset, a cure for
325 all, but if you know precisely what went wrong you can repair it
326 without resetting other console attributes. For example, after
338 your shell prompt will be all line-drawing characters. Now do (typing
349 and all is well again. (Three symbols typed to each cat: Ctrl-N (or
350 Ctrl-O), ENTER, Ctrl-D.) To understand what is happening, see `The
351 console character sets' below.
353 If you loaded some strange font, and want to return to the default,
361 will do (provided you stored the default font in the default place).
362 If this default font does not contain an embedded Unicode map (and
363 gives the wrong symbols for accented characters), then say
379 then I have a German keyboard, and the key left of the Enter key gives
380 me a-umlaut. This works, because the a-umlaut occurs on the CP437 code
381 page and the kernel Unicode map is initialized to CP437, and my video
382 card has a CP437 font built-in. If I now load an ISO 8859-1 font with
390 then everything still works, because setfont invalidates the kernel
391 Unicode map (if there is no Unicode map attached to the font), and
392 without map the kernel goes directly to the font, and that is pre-
393 cisely correct for an ISO 8859-1 system with iso01.f16 font. But
394 going back to the previous font with
402 gives capital Sigma's instead of a-umlaut - all accented letters are
403 mixed up because also this font has no embedded Unicode map. After
411 which loads the default Unicode map (which is right for the default
412 font) all works correctly again. Usually loadunimap is not invoked
413 directly, but via setfont. Thus, the previous two commands may be
422 The Ethiopian fonts and the lat1u*.psf fonts have embedded Unicode
423 code map. Most of the others don't.
425 On old terminals output involving tabs may require a delay, and you
436 You can change the video mode using resizecons or SVGATextMode. This
437 usually settles the output side. On the input side there are many
438 things that might be wrong. If X or DOOM or some other program using
439 raw mode crashed, your keyboard may still be in raw (or mediumraw)
440 mode, and it is difficult to give commands. (See "How to get out of
441 raw mode" below.) If you loaded a bad keymap, then
449 loads the default map again, but it may well be difficult to type `-'!
458 Sometimes even the letters are garbled. It is useful to know that
459 there are four main types of keyboards: QWERTY, QWERTZ, AZERTY and
460 DVORAK. The first three are named after the first six letter keys,
461 and roughly represent the English, German and French speaking coun-
462 tries. Compared to QWERTY, the QWERTZ map interchanges Y and Z.
463 Compared to QWERTY, the AZERTY map interchanges Q and A, W and Z, and
464 has its M right of the L, at the semicolon position. DVORAK has an
465 entirely different letter ordering. There are two types of Turkish
466 keyboard. The so-called `Q'-keyboard has a QWERTY layout, while the
467 `F'-keyboard has an entirely different layout, let us say fgGIod,
468 where G stands for Gbreve and I for dotlessi.
471 4
\b4.
\b.1
\b1.
\b. K
\bKe
\bey
\byb
\bbo
\boa
\bar
\brd
\bd h
\bha
\bar
\brd
\bdw
\bwa
\bar
\bre
\be r
\bre
\bes
\bse
\bet
\bt
474 Things may be wrong on a lower level than Linux knows about. There
475 are at least two distinct lower levels (keyboard and keyboard
476 controller) where one can give the command "keyboard disable" to the
477 keyboard hardware. Keyboards can often be programmed to use one out
478 of three different sets of scancodes.
480 However, I do not know of cases where this turned out to be a problem.
482 Some keyboards have a remapping capability built in. Stormy Henderson
483 (stormy@Ghost.Net) writes: `If it's your keyboard accidently being
484 reprogrammed, you can (on a Gateway AnyKey keyboard) press control-
485 alt-suspend_macro to reset the keys to normal.'
488 5
\b5.
\b. D
\bDe
\bel
\ble
\bet
\bte
\be a
\ban
\bnd
\bd B
\bBa
\bac
\bck
\bks
\bsp
\bpa
\bac
\bce
\be
491 Getting Delete and Backspace to work just right is nontrivial,
492 especially in a mixed environment, where you talk to console, to X, to
493 bash, to emacs, login remotely, etc. You may have to edit several
494 configuration files to tell all of the programs involved precisely
495 what you want. On the one hand, there is the matter of which keys
496 generate which codes (and how these codes are remapped by e.g. kermit
497 or emacs), and on the other hand the question of what functions are
500 People often complain `my backspace key does not work', as if this key
501 had a built-in function `delete previous character'. Unfortunately,
502 all this key, or any key, does is producing a code, and one only can
503 hope that the kernel tty driver and all application programs can be
504 configured such that the backspace key indeed does function as a
505 `delete previous character' key.
507 Most Unix programs get their tty input via the kernel tty driver in
508 `cooked' mode, and a simple stty command determines the erase
509 character. However, programs like bash and emacs and X do their own
510 input handling, and have to be convinced one-by-one to do the right
514 5
\b5.
\b.1
\b1.
\b. H
\bHo
\bow
\bw t
\bto
\bo t
\bte
\bel
\bll
\bl U
\bUn
\bni
\bix
\bx w
\bwh
\bha
\bat
\bt c
\bch
\bha
\bar
\bra
\bac
\bct
\bte
\ber
\br y
\byo
\bou
\bu w
\bwa
\ban
\bnt
\bt t
\bto
\bo u
\bus
\bse
\be t
\bto
\bo d
\bde
\bel
\ble
\bet
\bte
\be t
\bth
\bhe
\be
515 l
\bla
\bas
\bst
\bt t
\bty
\byp
\bpe
\bed
\bd c
\bch
\bha
\bar
\bra
\bac
\bct
\bte
\ber
\br
525 If the character is erased, but in a funny way, then something is
526 wrong with your tty settings. If echoprt is set, then erased charac-
527 ters are enclosed between \ and /. If echoe is not set, then the
528 erase char is echoed (which is reasonable when it is a printing
529 character, like #). Most people will want stty echoe -echoprt. Saying
530 stty sane will do this and more. Saying stty -a shows your current
531 settings. How come this is not right by default? It is, if you use
534 Note that many programs (like bash, emacs etc.) have their own
535 keybindings (defined in ~/.inputrc, ~/.emacs etc.) and are unaffected
536 by the setting of the erase character.
538 The standard Unix tty driver does not recognize a cursor, or keys
539 (like the arrow keys) to move the current position, and hence does not
540 have a command `delete current character' either. But for example you
541 can get bash on the console to recognize the Delete key by putting
544 set editing-mode emacs
553 5
\b5.
\b.1
\b1.
\b.1
\b1.
\b. `
\b`G
\bGe
\bet
\btt
\bty
\by u
\bus
\bse
\bed
\bd t
\bto
\bo d
\bdo
\bo t
\bth
\bhe
\be r
\bri
\big
\bgh
\bht
\bt t
\bth
\bhi
\bin
\bng
\bg w
\bwi
\bit
\bth
\bh D
\bDE
\bEL
\bL a
\ban
\bnd
\bd B
\bBS
\bS b
\bbu
\but
\bt i
\bis
\bs b
\bbr
\bro
\bo-
\b-
554 k
\bke
\ben
\bn n
\bno
\bow
\bw?
\b?'
\b'
557 Earlier, the console driver would do BS Space BS (\010\040\010) when
558 it got a DEL (\177). Nowadays, DEL's are ignored (as they should be,
559 since the driver emulates a vt100). Get a better getty, i.e., one that
563 5
\b5.
\b.1
\b1.
\b.2
\b2.
\b. `
\b`L
\bLo
\bog
\bgi
\bin
\bn b
\bbe
\beh
\bha
\bav
\bve
\bes
\bs d
\bdi
\bif
\bff
\bfe
\ber
\bre
\ben
\bnt
\btl
\bly
\by a
\bat
\bt t
\bth
\bhe
\be f
\bfi
\bir
\brs
\bst
\bt a
\ban
\bnd
\bd s
\bse
\bec
\bco
\bon
\bnd
\bd l
\blo
\bog
\bgi
\bin
\bn
564 a
\bat
\btt
\bte
\bem
\bmp
\bpt
\bts
\bs?
\b?'
\b'
567 At the first attempt, you are talking to getty. At the second attempt,
568 you are talking to login, a different program.
571 5
\b5.
\b.2
\b2.
\b. H
\bHo
\bow
\bw t
\bto
\bo t
\bte
\bel
\bll
\bl L
\bLi
\bin
\bnu
\bux
\bx w
\bwh
\bha
\bat
\bt c
\bco
\bod
\bde
\be t
\bto
\bo g
\bge
\ben
\bne
\ber
\bra
\bat
\bte
\be w
\bwh
\bhe
\ben
\bn a
\ba k
\bke
\bey
\by i
\bis
\bs p
\bpr
\bre
\bes
\bss
\bse
\bed
\bd
574 On the console, or, more precisely, when not in (MEDIUM)RAW mode, use
577 % loadkeys mykeys.map
585 % xmodmap mykeys.xmap
590 Note that (since XFree86-2.1) X reads the Linux settings of the
591 keymaps when initialising the X keymap. Although the two systems are
592 not 100% compatible, this should mean that in many cases the use of
593 xmodmap has become superfluous.
595 For example, suppose that you would like the Backspace key to send a
596 BackSpace (Ctrl-H, octal 010) and the grey Delete key a DEL (octal
597 0177). Add the following to /etc/rc.local (or wherever you keep your
598 local boot-time stuff):
601 /usr/bin/loadkeys << EOF
602 keycode 14 = BackSpace
609 Note that this will only change the function of these keys when no
610 modifiers are used. (You need to specify a keymaps line to tell which
611 keymaps should be affected if you want to change bindings on more
612 keymaps.) The Linux kernel default lets Ctrl-Backspace generate
613 BackSpace - this is sometimes useful as emergency escape, when you
614 find you can only generate DELs.
616 The left Alt key is sometimes called the Meta key, and by default the
617 combinations AltL-X are bound to the symbol MetaX. But what character
618 sequence is MetaX? That is determined (per-tty) by the Meta flag, set
619 by the command setmetamode. The two choices are: ESC X or X or-ed with
622 Many distributions have a loadkeys command somewhere in the bootup
623 sequence. For example, one may have the name of the desired keymap in
624 /etc/sysconfig/keyboard and the loadkeys command that loads it in
625 /etc/rc.d/init.d/keytable. Or one may have the actual default keymap
626 in /etc/default.keytab and the loadkeys command that loads it in
627 /etc/rc.d/boot. Etc. Instead of adding a local modification to the
628 default, one can of course change the default by editing the default
629 keymap or changing the name of the keymap to be loaded at boot time.
630 Note that loadkeys itself has default keymap defkeymap.map located
631 somewhere under /usr/lib/kbd or /usr/share/kbd (just like all other
632 keymaps) and this may not yet be available in single user boot before
633 /usr has been mounted.
636 5
\b5.
\b.2
\b2.
\b.1
\b1.
\b. `
\b`H
\bHo
\bow
\bw d
\bdo
\bo I
\bI g
\bge
\bet
\bt a
\ba d
\bdv
\bvo
\bor
\bra
\bak
\bk k
\bke
\bey
\byb
\bbo
\boa
\bar
\brd
\bd?
\b?'
\b'
646 will give you a dvorak layout, probably by loading something like
647 /usr/lib/kbd/keymaps/i386/dvorak/dvorak.map.gz. Under X, put
661 5
\b5.
\b.2
\b2.
\b.2
\b2.
\b. `
\b`W
\bWh
\bhy
\by d
\bdo
\boe
\bes
\bsn
\bn'
\b't
\bt t
\bth
\bhe
\be B
\bBa
\bac
\bck
\bks
\bsp
\bpa
\bac
\bce
\be k
\bke
\bey
\by g
\bge
\ben
\bne
\ber
\bra
\bat
\bte
\be B
\bBa
\bac
\bck
\bkS
\bSp
\bpa
\bac
\bce
\be b
\bby
\by d
\bde
\bef
\bfa
\bau
\bul
\blt
\bt?
\b?'
\b'
664 (i) Because the VT100 had a Delete key above the Enter key.
666 (ii) Because Linus decided so.
669 5
\b5.
\b.3
\b3.
\b. H
\bHo
\bow
\bw t
\bto
\bo t
\bte
\bel
\bll
\bl X
\bX t
\bto
\bo i
\bin
\bnt
\bte
\ber
\brc
\bch
\bha
\ban
\bng
\bge
\be D
\bDe
\bel
\ble
\bet
\bte
\be a
\ban
\bnd
\bd B
\bBa
\bac
\bck
\bks
\bsp
\bpa
\bac
\bce
\be
674 % xmodmap -e "keysym BackSpace = Delete" -e "keysym Delete = BackSpace"
679 Or, if you just want the Backspace key to generate a BackSpace:
682 % xmodmap -e "keycode 22 = BackSpace"
687 Or, if you just want the Delete key to generate a Delete:
690 % xmodmap -e "keycode 107 = Delete"
695 (but usually this is the default binding already).
698 5
\b5.
\b.4
\b4.
\b. H
\bHo
\bow
\bw t
\bto
\bo t
\bte
\bel
\bll
\bl e
\bem
\bma
\bac
\bcs
\bs w
\bwh
\bha
\bat
\bt t
\bto
\bo d
\bdo
\bo w
\bwh
\bhe
\ben
\bn i
\bit
\bt r
\bre
\bec
\bce
\bei
\biv
\bve
\bes
\bs a
\ba D
\bDe
\bel
\ble
\bet
\bte
\be o
\bor
\br
699 B
\bBa
\bac
\bck
\bks
\bsp
\bpa
\bac
\bce
\be
702 Put in your .emacs file lines like
705 (global-set-key "\?" 'help-command)
706 (global-set-key "\C-h" 'delete-backward-char)
711 Of course you can bind other commands to other keys in the same way.
712 Note that various major and minor modes redefine keybindings. For
713 example, in incremental search mode one finds the code
716 (define-key map "\177" 'isearch-delete-char)
717 (define-key map "\C-h" 'isearch-mode-help)
722 This means that it may be a bad idea to use the above two global-set-
723 key commands. There are too many places where there are built-in
724 assumptions about Ctrl-H = help and DEL = delete. That doesn't mean
725 that you have to setup keys so that Backspace generates DEL. But if it
726 doesn't then it is easiest to remap them at the lowest possible level
730 5
\b5.
\b.5
\b5.
\b. H
\bHo
\bow
\bw t
\bto
\bo t
\bte
\bel
\bll
\bl e
\bem
\bma
\bac
\bcs
\bs t
\bto
\bo i
\bin
\bnt
\bte
\ber
\brc
\bch
\bha
\ban
\bng
\bge
\be D
\bDe
\bel
\ble
\bet
\bte
\be a
\ban
\bnd
\bd B
\bBa
\bac
\bck
\bks
\bsp
\bpa
\bac
\bce
\be
733 Put in your .emacs file lines
736 (setq keyboard-translate-table (make-string 128 0))
739 (aset keyboard-translate-table i i)
741 (aset keyboard-translate-table ?\b ?\^?)
742 (aset keyboard-translate-table ?\^? ?\b)
747 Recent versions of emacs have a function keyboard-translate and one
748 may simplify the above to
751 (keyboard-translate ?\C-h ?\C-?)
752 (keyboard-translate ?\C-? ?\C-h)
757 Note that under X emacs can distinguish between Ctrl-h and the
758 Backspace key (regardless of what codes these produce on the console),
759 and by default emacs will view the Backspace key as DEL (and do dele-
760 tion things, as bound to that character, rather than help things,
761 bound to Ctrl-H). One can distinguish Backspace and Delete, e.g. by
764 (global-unset-key [backspace] )
765 (global-set-key [backspace] 'delete-backward-char)
766 (global-unset-key [delete] )
767 (global-set-key [delete] 'delete-char)
773 5
\b5.
\b.6
\b6.
\b. H
\bHo
\bow
\bw t
\bto
\bo t
\bte
\bel
\bll
\bl k
\bke
\ber
\brm
\bmi
\bit
\bt t
\bto
\bo i
\bin
\bnt
\bte
\ber
\brc
\bch
\bha
\ban
\bng
\bge
\be D
\bDe
\bel
\ble
\bet
\bte
\be a
\ban
\bnd
\bd B
\bBa
\bac
\bck
\bks
\bsp
\bpa
\bac
\bce
\be
776 Put in your .kermrc file the lines
786 5
\b5.
\b.7
\b7.
\b. H
\bHo
\bow
\bw t
\bto
\bo t
\bte
\bel
\bll
\bl x
\bxt
\bte
\ber
\brm
\bm t
\bto
\bo i
\bin
\bnt
\bte
\ber
\brc
\bch
\bha
\ban
\bng
\bge
\be D
\bDe
\bel
\ble
\bet
\bte
\be a
\ban
\bnd
\bd B
\bBa
\bac
\bck
\bks
\bsp
\bpa
\bac
\bce
\be
793 XTerm*VT100.Translations: #override\n\
794 <KeyPress> BackSpace : string(0x7f)\n\
795 <KeyPress> Delete : string(0x08)\n
801 5
\b5.
\b.8
\b8.
\b. H
\bHo
\bow
\bw t
\bto
\bo t
\bte
\bel
\bll
\bl x
\bxt
\bte
\ber
\brm
\bm a
\bab
\bbo
\bou
\but
\bt y
\byo
\bou
\bur
\br f
\bfa
\bav
\bvo
\bou
\bur
\bri
\bit
\bte
\be t
\btt
\bty
\by m
\bmo
\bod
\bde
\bes
\bs
804 Normally xterm will inherit the tty modes from its invoker. Under
805 xdm, the default erase and kill characters are # and @, as in good old
806 Unix Version 6. If you don't like that, you might put something like
809 XTerm*ttymodes: erase ^? kill ^U intr ^C quit ^\ eof ^D \
810 susp ^Z start ^Q stop ^S eol ^@
815 in /usr/lib/X11/app-defaults/XTerm or in $HOME/.Xresources, assuming
819 xrdb -merge $HOME/.Xresources
824 in your $HOME/.xinitrc or $HOME/.xsession.
827 5
\b5.
\b.9
\b9.
\b. H
\bHo
\bow
\bw t
\bto
\bo t
\bte
\bel
\bll
\bl x
\bxm
\bmo
\bos
\bsa
\bai
\bic
\bc t
\bth
\bha
\bat
\bt t
\bth
\bhe
\be B
\bBa
\bac
\bck
\bks
\bsp
\bpa
\bac
\bce
\be k
\bke
\bey
\by g
\bge
\ben
\bne
\ber
\bra
\bat
\bte
\bes
\bs a
\ba D
\bDE
\bEL
\bL
833 *XmText.translations: #override\n\
834 <Key>osfDelete: delete-previous-character()
835 *XmTextField.translations: #override\n\
836 <Key>osfDelete: delete-previous-character()
841 in your $HOME/.Xdefaults or $HOME/.Xresources helps. (What file? The
842 file that is fed to xrdb, for example in .xinitrc.)
844 The netscape FAQ, however, says:
859 Why doesn't my Backspace key work in text fields?
860 By default, Linux and XFree86 come with the Backspace and Delete keys
861 misconfigured. All Motif programs (including, of course, Netscape
862 Navigator) will malfunction in the same way.
864 The Motif spec says that Backspace is supposed to delete the previous
865 character and Delete is supposed to delete the following character.
866 Linux and XFree86 come configured with both the Backspace and Delete
867 keys generating Delete.
869 You can fix this by using any one of the xmodmap, xkeycaps, or
870 loadkeys programs to make the key in question generate the BackSpace
871 keysym instead of Delete.
873 You can also fix it by having a .motifbind file; see the man page
874 for VirtualBindings(3).
876 Note: Don't use the *XmText.translations or *XmTextField.translations
877 resources to attempt to fix this problem. If you do, you will blow
878 away Netscape Navigator's other text-field key bindings.
883 5
\b5.
\b.1
\b10
\b0.
\b. A
\bA b
\bbe
\bet
\btt
\bte
\ber
\br s
\bso
\bol
\blu
\but
\bti
\bio
\bon
\bn f
\bfo
\bor
\br M
\bMo
\bot
\bti
\bif
\bf-
\b-u
\bus
\bsi
\bin
\bng
\bg p
\bpr
\bro
\bog
\bgr
\bra
\bam
\bms
\bs,
\b, l
\bli
\bik
\bke
\be n
\bne
\bet
\bts
\bsc
\bca
\bap
\bpe
\be
886 Ted Kandell (ted@tcg.net) suggests the following:
888 Somewhere in your .profile add the following:
896 If you are using bash, add the following lines to your .inputrc:
900 "\C-h": backward-delete-char
905 Add the following lines to your .xinitrc file:
909 keycode 22 = BackSpace osfBackSpace
913 # start your window manager here, for example:
914 #(fvwm) 2>&1 | tee /dev/tty /dev/console
919 keycode 14 = BackSpace
925 This will definitely work for a PC 101 or 102 key keyboard with any
926 Linux/XFree86 layout.
928 The important part to making Motif apps like Netscape work properly is
929 adding osfBackSpace to keycode 22 in addition to BackSpace.
931 Note that there must be spaces on either side of the = sign.
935 5
\b5.
\b.1
\b11
\b1.
\b. W
\bWh
\bha
\bat
\bt a
\bab
\bbo
\bou
\but
\bt t
\bte
\ber
\brm
\bmc
\bca
\bap
\bp a
\ban
\bnd
\bd t
\bte
\ber
\brm
\bmi
\bin
\bnf
\bfo
\bo?
\b?
938 When people have problems with backspace, they tend to look at their
939 termcap (or terminfo) entry for the terminal, and indeed, there does
940 exist a kb (or kbs) capability describing the code generated by the
941 Backspace key. However, not many programs use it, so unless you are
942 having problems with one particular program only, probably the fault
943 is elsewhere. Of course it is a good idea anyway to correct your
944 termcap (terminfo) entry. See also below under "The TERM variable".
947 5
\b5.
\b.1
\b12
\b2.
\b. A
\bA c
\bco
\bom
\bmp
\bpl
\ble
\bet
\bte
\be s
\bso
\bol
\blu
\but
\bti
\bio
\bon
\bn
949 There are many possibilities to get a functioning system. Can't you
950 give one complete set of settings that works?
952 One way of getting a setup that works in all contexts is to have the
953 Backspace key generate DEL when on the console (or xterm), and
954 BackSpace when under X. Maybe that is most convenient - there are too
955 many X utilities that expect BackSpace, and emacs on the console or
956 xterm expects DEL, while emacs under X can distinguish [BackSpace]
957 from Ctrl-H and does the right thing.
959 What is needed? No loadkeys changes, since the Backspace key already
960 generates DEL by default. No stty settings, they are OK by default.
961 No X settings, they are OK by default. One just has to tell xterm
962 that the Backspace key should generate DEL: put
965 XTerm*VT100.Translations: #override\n\
966 <KeyPress> BackSpace : string(0x7f)\n\
974 xrdb -merge .Xresources
979 in .xinitrc, and you are settled.
981 For a much more extensive discussion of these things, and alternative
982 solutions, see Anne Baretta's page.
985 6
\b6.
\b. T
\bTh
\bhe
\be c
\bco
\bon
\bns
\bso
\bol
\ble
\be c
\bch
\bha
\bar
\bra
\bac
\bct
\bte
\ber
\br s
\bse
\bet
\bts
\bs
988 The kernel first tries to figure out what symbol is meant by any given
989 user byte, and next where this symbol is located in the current font.
991 The kernel knows about 5 translations of bytes into console-screen
992 symbols. In Unicode (UTF-8) mode, the UTF-8 code is just converted
993 directly into Unicode. The assumption is that almost all symbols one
994 needs are present in Unicode, and for the cases where this does not
995 hold the codes 0xff** are reserved for direct font access. When not
996 in Unicode mode, one of four translation tables is used. The four
997 tables are: a) Latin1 -> Unicode, b) VT100 graphics -> Unicode, c) PC
998 -> Unicode, d) user-defined.
1000 There are two character sets, called G0 and G1, and one of them is the
1001 current character set. (Initially G0.) Typing Ctrl-N causes G1 to
1002 become current, Ctrl-O causes G0 to become current.
1004 These variables G0 and G1 point at a translation table, and can be
1005 changed by the user. Initially they point at tables a) and b),
1006 respectively. The sequences ESC ( B and ESC ( 0 and ESC ( U and ESC (
1007 K cause G0 to point at translation table a), b), c) and d),
1008 respectively. The sequences ESC ) B and ESC ) 0 and ESC ) U and ESC )
1009 K cause G1 to point at translation table a), b), c) and d),
1012 The sequence ESC c causes a terminal reset, which is what you want if
1013 the screen is all garbled. The oft-advised echo ^V^O will only make G0
1014 current, but there is no guarantee that G0 points at table a). In
1015 some distributions there is a program reset(1) that just does echo
1016 ^[c. If your termcap entry for the console is correct (and has an
1017 entry :rs=\Ec:), then also setterm -reset will work.
1019 The user-defined mapping table can be set using mapscrn(8). The
1020 result of the mapping is that if a symbol c is printed, the symbol s =
1021 map[c] is sent to the video memory. The bitmap that corresponds to s
1022 is found in the character ROM, and can be changed using setfont(8).
1025 7
\b7.
\b. C
\bCo
\bon
\bns
\bso
\bol
\ble
\be s
\bsw
\bwi
\bit
\btc
\bch
\bhi
\bin
\bng
\bg
1028 By default, console switching is done using Alt-Fn or Ctrl-Alt-Fn.
1029 Under X (or recent versions of dosemu), only Ctrl-Alt-Fn works. Many
1030 keymaps will allow cyclic walks through all allocated consoles using
1031 Alt-RightArrow and Alt-LeftArrow.
1033 XFree86 1.3 does not know that Alt is down when you switch to the X
1034 window. Thus, you cannot switch immediately to some other VT again but
1035 have to release Alt first. In the other direction this should work:
1036 the kernel always keeps track of the up/down status of all keys. (As
1037 far as possible: on some keyboards some keys do not emit a scancode
1038 when pressed (e.g.: the PFn keys of a FOCUS 9000) or released (e.g.:
1039 the Pause key of many keyboards).)
1041 XFree86 1.3 saves the fonts loaded in the character ROMs when started,
1042 and restores it on a console switch. Thus, the result of setfont on a
1043 VT is wiped out when you go to X and back. Using setfont under X will
1044 lead to funny results.
1046 One can change VT under program control using the chvt command.
1049 7
\b7.
\b.1
\b1.
\b. C
\bCh
\bha
\ban
\bng
\bgi
\bin
\bng
\bg t
\bth
\bhe
\be n
\bnu
\bum
\bmb
\bbe
\ber
\br o
\bof
\bf V
\bVi
\bir
\brt
\btu
\bua
\bal
\bl C
\bCo
\bon
\bns
\bso
\bol
\ble
\bes
\bs
1052 This question still comes up from time to time, but the answer is: you
1053 already have enough of them. Since kernel version 1.1.54, there are
1054 between 1 and 63 virtual consoles. A new one is created as soon as it
1055 is opened. It is removed by the utility deallocvt (but it can be
1056 removed only when no processes are associated to it anymore, and no
1057 text on it has been selected by programs like selection or gpm).
1059 For older kernels, change the line
1062 #define NR_CONSOLES 8
1067 in include/linux/tty.h (don't increase this number beyond 63), and
1068 recompile the kernel.
1070 If they do not exist yet, create the tty devices with MAKEDEV or mknod
1071 ttyN c 4 N where N denotes the tty number. For example,
1074 for i in 9 10 11 12; do mknod /dev/tty$i c 4 $i; done
1079 or, better (since it also takes care of owner and permissions),
1082 for i in 9 10 11 12; do /dev/MAKEDEV tty$i; done
1087 If you want the new VCs to run getty, add lines in /etc/inittab. (But
1088 it is much better to have only two getty's running, and to create more
1089 consoles dynamically as the need arises. That way you'll have more
1090 memory when you don't use all these consoles, and also more consoles,
1091 in case you really need them. Edit /etc/inittab and comment out all
1092 getty's except for the first two.)
1094 When the consoles are allocated dynamically, it is usually easiest to
1095 have only one or two running getty. More are opened by open -l -s
1096 bash. Unused consoles (without associated processes) are deallocated
1097 using deallocvt (formerly disalloc). But, you say, I am involved in
1098 activities when I suddenly need more consoles, and do not have a bash
1099 prompt available to give the open command. Fortunately it is possible
1100 to create a new console upon a single keystroke, regardless of what is
1101 happening at the current console.
1103 If you have spawn_login from kbd-0.99.tar.gz and you put
1107 alt keycode 103 = Spawn_Console
1114 in /etc/rc.local, then typing Alt-UpArrow will create a fresh VC run-
1115 ning login (and switch to it). With spawn_console & instead of
1116 spawn_login & you'll have bash running there. See also open-1.4.tgz
1117 and dynamic-vc-1.1.tar.gz.
1119 What action should be taken upon this Spawn_Console keypress can also
1120 be set in /etc/inittab under kbrequest, if you have a recent init. See
1123 (This action can be something entirely different - I just called the
1124 key Spawn_Console because that is what I used it for. When used for
1125 other purposes it is less confusing to use its synonym KeyboardSignal.
1126 For example, some people like to put the lines
1129 kb::kbrequest:/sbin/shutdown -h now
1134 in /etc/inittab, and
1137 control alt keycode 79 = KeyboardSignal
1138 control alt keycode 107 = KeyboardSignal
1143 in their keymap. Now Ctrl-Alt-End will do a system shutdown.)
1145 You can only login as "root" on terminals listed in /etc/securetty.
1146 There exist programs that read terminal settings from files /etc/ttys
1147 and /etc/ttytype. If you have such files, and create additional
1148 consoles, then it might be a good idea to also add entries for them in
1152 8
\b8.
\b. C
\bCt
\btr
\brl
\bl-
\b-A
\bAl
\blt
\bt-
\b-D
\bDe
\bel
\bl a
\ban
\bnd
\bd o
\bot
\bth
\bhe
\ber
\br s
\bsp
\bpe
\bec
\bci
\bia
\bal
\bl k
\bke
\bey
\by c
\bco
\bom
\bmb
\bbi
\bin
\bna
\bat
\bti
\bio
\bon
\bns
\bs
1156 8
\b8.
\b.1
\b1.
\b. C
\bCt
\btr
\brl
\bl-
\b-A
\bAl
\blt
\bt-
\b-D
\bDe
\bel
\bl (
\b(B
\bBo
\boo
\bot
\bt)
\b)
1159 If you press Ctrl-Alt-Del (or whatever key was assigned the keysym
1160 Boot by loadkeys) then either the machine reboots immediately (without
1161 sync), or init is sent a SIGINT. The former behaviour is the default.
1162 The default can be changed by root, using the system call reboot(),
1163 see ctrlaltdel(8). Some init's change the default. What happens when
1164 init gets SIGINT depends on the version of init used - often it will
1165 be determined by the pf entry in /etc/inittab (which means that you
1166 can run an arbitrary program in this case). In the current kernel
1167 Ctrl-AltGr-Del is no longer by default assigned to Boot.
1170 8
\b8.
\b.2
\b2.
\b. O
\bOt
\bth
\bhe
\ber
\br c
\bco
\bom
\bmb
\bbi
\bin
\bna
\bat
\bti
\bio
\bon
\bns
\bs
1174 Name Default binding
1175 -------------------------------
1176 Show_Memory Shift-Scrollock
1177 Show_Registers AltGr-ScrollLock
1178 Show_State Ctrl-ScrollLock
1179 Console_n Alt-Fn and Ctrl-Alt-Fn (1 <= n <= 12)
1180 Console_{n+12} AltGr-Fn (1 <= n <= 12)
1181 Incr_Console Alt-RightArrow
1182 Decr_Console Alt-LeftArrow
1183 Last_Console Alt[Gr]-PrintScreen
1184 Scroll_Backward Shift-PageUp
1185 Scroll_Forward Shift-PageDown
1186 Caps_On (CapsLock is a toggle; this key sets)
1189 8
\b8.
\b.3
\b3.
\b. X
\bX C
\bCo
\bom
\bmb
\bbi
\bin
\bna
\bat
\bti
\bio
\bon
\bns
\bs
1193 Ctrl-Alt-Fn Switch to VT n
1194 Ctrl-Alt-KP+ Next mode
1195 Ctrl-Alt-KP- Previous mode
1196 Ctrl-Alt-Backspace Kill X
1199 On some motherboards, Ctrl-Alt-KP- and Ctrl-Alt-KP+ will be equivalent
1200 to pressing the Turbo button. That is, both will produce the scancodes
1201 1d 38 4a ca b8 9d and 1d 38 4e ce b8 9d, and both will switch between
1202 Turbo (>= 25MHz) and non-Turbo (8 or 12 MHz). (Often these key combi-
1203 nations only function this way when enabled by jumpers on the mother-
1206 Perry F Nguyen (pfnguyen@netcom22.netcom.com) writes: AMI BIOS has a
1207 feature that locks up the keyboard and flashes the LED's if the Ctrl-
1208 Alt-Backspace combination is pressed while a BIOS password is enabled,
1209 until the CMOS/BIOS password is typed in.
1212 8
\b8.
\b.4
\b4.
\b. D
\bDo
\bos
\bse
\bem
\bmu
\bu C
\bCo
\bom
\bmb
\bbi
\bin
\bna
\bat
\bti
\bio
\bon
\bns
\bs
1216 Ctrl-Alt-Fn Switch to VT n (from version 0.50; earlier Alt-Fn)
1217 Ctrl-Alt-PgDn Kill dosemu (when in RAW keyboard mode)
1218 (and many other combinations - see the dosemu documentation)
1223 8
\b8.
\b.5
\b5.
\b. C
\bCo
\bom
\bmp
\bpo
\bos
\bsi
\bin
\bng
\bg s
\bsy
\bym
\bmb
\bbo
\bol
\bls
\bs
1226 One symbol may be constructed using several keystrokes.
1228 +
\bo LeftAlt-press, followed by a decimal number typed on the keypad,
1229 followed by LeftAlt-release, yields the symbol with code given by
1230 this number. (In Unicode mode this same mechanism, but then with 4
1231 hexadecimal digits, may be used to define a Unicode symbol.)
1233 +
\bo A dead diacritic followed by a symbol, yields that symbol adorned
1234 with that diacritic. If the combination is undefined, both keys are
1235 taken separately. Which keys are dead diacritics is user-settable;
1236 none is by default. Five (since 2.0.25 six) dead diacritics can be
1237 defined (using loadkeys(1)): dead_grave, dead_acute,
1238 dead_circumflex, dead_tilde, dead_diaeresis (and dead_cedilla).
1239 Precisely what this adorning means is also user-settable: dead-
1240 diacritic, symbol is equivalent to Compose + diacritic + symbol.
1242 +
\bo Compose followed by two symbols yields a combination symbol. These
1243 combinations are user-settable. Today there are 68 combinations
1244 defined by default; you can see them by saying "dumpkeys | grep
1247 +
\bo Then there are `Sticky' modifier keys (since 1.3.33). For example,
1248 one can type Ctrl-C as SControl, C and Ctrl-Alt-BackSpace as
1249 SControl, SAlt, BackSpace.
1251 Note that there are at least four such composition mechanisms:
1253 1. The Linux keyboard driver mechanism, used in conjunction with
1255 2. The X mechanism - see X386keybd(1), later XFree86kbd(1). Under
1256 X11R6: edit /usr/X11R6/lib/X11/locale/iso8859-1/Compose.
1258 See also Andrew D. Balsa's comments at
1259 http://wauug.erols.com/~balsa/linux/deadkeys/index.html.
1261 3. The emacs mechanism obtained by loading "iso-insert.el" or calling
1264 4. The vim mechanism: insert a composed symbol by pressing Ctrl-K
1265 followed by two symbols. A list of the possible combinations is
1266 obtained by the command :digraphs.
1268 For X the order of the two symbols is arbitrary: both Compose-,-c
1269 and Compose-c-, yield a c-cedilla; for Linux and emacs only the
1270 former sequence works by default. For X and vim the list of compose
1271 combinations is fixed. Linux and emacs are flexible. The default
1272 lists are somewhat similar, but the details are different.
1275 8
\b8.
\b.6
\b6.
\b. T
\bTh
\bhe
\be S
\bSy
\bys
\bsR
\bRq
\bq k
\bke
\bey
\by
1277 In case your kernel was compiled with CONFIG_MAGIC_SYSRQ enabled (a
1278 feature that is present since Linux 2.1.43) there is a single key
1279 (defined in <linux/keyboard.h>) to which special system functions are
1280 attached, regardless of the current keyboard mode. For the PC
1281 architecture this special key is, naturally, the Alt+SysRq key, and
1282 any of the two Alt keys will work. (Note that if CONFIG_MAGIC_SYSRQ
1283 was not enabled, the default action of this key is to return to the
1286 If you press this key, do not release it, and hit another key, a
1287 corresponding action is performed. The action is performed whether
1288 anybody is logged in or not, is root or not. For the details, see
1289 drivers/char/sysrq.c. Since this feature is meant only for kernel
1290 hackers, that should suffice. Still, let me add a few remarks.
1292 For the key r the keyboard mode is reset to K_XLATE. For the key k a
1293 SAK and console reset is done. For the key b the machine is rebooted
1294 immediately. (See, not something you want to have enabled on a
1295 production machine.) For the key o the power is turned off (when the
1296 machine is capable of that). For the key s an emergency sync is
1297 scheduled. For the key u an emergency read-only remount is scheduled.
1298 For the keys p,t,m various information is shown (namely the same
1299 information also shown for RAlt,RCtrl,RShift+ScrollLock). For the
1300 keys e,i,l all processes get a SIG_TERM or SIG_KILL, respectively; for
1301 l even the init process is killed. Digits set the log level. Anything
1302 else prints a short summary: SysRq: unRaw saK Boot Off Sync Unmount
1303 showPc showTasks showMem loglevel0-8 tErm kIll killalL.
1305 Note: These are very dangerous actions! And they do not use your
1306 keymap - indeed, are meant for emergency cases where the state of your
1307 keymap, or even of the entire kernel, is uncertain. If you use a
1308 dvorak keyboard - bad luck! Most other people will be able to survive:
1309 the dangerous letters A,M,Q,W,Y,Z that are differently placed on
1310 English, French and German keyboards, are not used for actions. (But
1311 if your finger slips and you hit L instead of K - bye bye to your
1315 9
\b9.
\b. H
\bHo
\bow
\bw t
\bto
\bo g
\bge
\bet
\bt o
\bou
\but
\bt o
\bof
\bf r
\bra
\baw
\bw m
\bmo
\bod
\bde
\be
1318 If some program using K_RAW keyboard mode exits without restoring the
1319 keyboard mode to K_XLATE, then it is difficult to do anything - not
1320 even Ctrl-Alt-Del works. However, it is sometimes possible to avoid
1321 hitting the reset button. (And desirable as well: your users may get
1322 angry if you kill their Hack game by rebooting; you might also damage
1323 your file system.) Easy solutions involve logging in from another
1324 terminal or another machine and doing kbd_mode -a. The procedure
1325 below assumes that no X is running, that the display is in text mode,
1326 and that you are at your bash prompt, that you are using a US keyboard
1327 layout, and that your interrupt character is Ctrl-C.
1329 Step 1. Start X. As follows: press 2 (and don't release), press F12
1330 (and don't release) and immediately afterwards press = . This starts
1331 X. (Explanation: if a key press produces keycode K, then the key
1332 release produces keycode K+128. Probably your shell does not like
1333 these high characters, so we avoid generating them by not releasing
1334 any key. However, we have to be quick, otherwise key repeat starts.
1335 The digit 2 produces a Ctrl-C that discards previous junk, the F12
1336 produces an X and the = a Return.) Probably your screen will be grey
1337 now, since no .xinitrc was specified. However, Ctrl-Alt-Fn will work
1338 and you can go to another VT. (Ctrl-Alt-Backspace also works, but
1339 that exits X, and gets you back into the previous state, which is not
1342 Step 2. Setup to change the keyboard mode. (For example, by sleep 5;
1345 Step 3. Leave X again. Alt-Fx (often Alt-F7) brings you back to X,
1346 and then Ctrl-Alt-Backspace exits X. Within 5 seconds your keyboard
1347 will be usable again.
1349 If you want to prepare for the occasion, then make \215A\301 (3
1350 symbols) an alias for kbd_mode -a. Now just hitting = F7 = (3
1351 symbols) will return you to sanity.
1354 1
\b10
\b0.
\b. T
\bTh
\bhe
\be k
\bke
\bey
\byb
\bbo
\boa
\bar
\brd
\bd L
\bLE
\bED
\bDs
\bs
1357 1. There are per-tty keyboard flags: each VC has its own NumLock,
1358 CapsLock, ScrollLock. By default these keyboard flags are shown in
1359 the LEDs. The usual way to change them is by pressing the
1360 corresponding key. (Side remark: pressing the NumLock key when in
1361 application key mode will not change the NumLock status, but produce
1362 an escape sequence. If you want the NumLock key to always change the
1363 Numlock status, bind it to Bare_Num_Lock.)
1365 2. Next, there are per-tty default keyboard flags, to initialize the
1366 keyboard flags when a reset occurs. Thus if you want NumLock on all
1367 the time, that is possible. The usual way to change them is by
1370 3. There is the possibility that the leds do not reflect the keyboard
1371 flags, but something else.
1373 3A. This something else can be three bits somewhere in the kernel -
1374 which can be used if you want to monitor some hardware or software
1375 status bit(s). If you want this, edit the kernel source to call
1376 register_leds() somewhere.
1378 3B. This something else can also be whatever some user program wants
1379 to show in the LEDs. Thus, people who like such things can make nice
1380 patterns of lights. If you want this, use the KDSETLED ioctl.
1382 This latter use is not per-tty, but the choice between former and
1383 latter use is per-tty.
1385 Summarizing: Each tty has a flag kbd->ledmode. If this has the value
1386 LED_SHOW_FLAGS then the keyboard flags (NumLock etc.) of that tty are
1387 shown. If this has the value LED_SHOW_MEM then three selected memory
1388 addresses are shown. If this has the value LED_SHOW_IOCTL then the
1389 leds show whatever value was last assigned to them using the KDSETLED
1392 One may add that X uses ioctl's to set the LEDs, but fails to reset
1393 its VT when it exits, so after using X there may be one VT that is not
1394 in the default LED_SHOW_FLAGS state. This can be fixed by doing
1395 `setleds -L' on that VT. See setleds(1).
1398 1
\b11
\b1.
\b. T
\bTh
\bhe
\be T
\bTE
\bER
\bRM
\bM v
\bva
\bar
\bri
\bia
\bab
\bbl
\ble
\be
1401 Many programs use the TERM variable and the database /etc/termcap or
1402 /usr/lib/terminfo/* to decide which strings to send for clear screen,
1403 move cursor, etc., and sometimes also to decide which string is sent
1404 by the users backspace key, function keys etc. This value is first
1405 set by the kernel (for the console). Usually, this variable is re-set
1406 by getty, using /etc/ttytype or the argument specified in
1407 /etc/inittab. Sometimes, it is also set in /etc/profile.
1409 Older systems use TERM=console or TERM=con80x25. Newer systems (with
1410 ncurses 1.8.6) use the more specific TERM=linux or TERM=linux-80x25.
1411 However, old versions of setterm test for TERM=con* and hence fail to
1412 work with TERM=linux.
1414 Since kernel version 1.3.2, the kernel default for the console is
1417 If you have a termcap without entry for linux, add the word linux to
1418 the entry for the console:
1421 console|con80x25|linux:\
1426 and make /usr/lib/terminfo/l/linux a copy of or symbolic link to
1427 /usr/lib/terminfo/c/console.
1430 1
\b11
\b1.
\b.1
\b1.
\b. T
\bTe
\ber
\brm
\bmi
\bin
\bnf
\bfo
\bo
1433 The terminfo entry for the linux console from ncurses 1.8.6 misses the
1434 entry kich1=\E[2~, needed by some programs. Edit the file and tic it.
1437 1
\b12
\b2.
\b. H
\bHo
\bow
\bw t
\bto
\bo m
\bma
\bak
\bke
\be o
\bot
\bth
\bhe
\ber
\br p
\bpr
\bro
\bog
\bgr
\bra
\bam
\bms
\bs w
\bwo
\bor
\brk
\bk w
\bwi
\bit
\bth
\bh n
\bno
\bon
\bn-
\b-A
\bAS
\bSC
\bCI
\bII
\bI c
\bch
\bha
\bar
\brs
\bs
1440 In the bad old days this used to be quite a hassle. Every separate
1441 program had to be convinced individually to leave your bits alone.
1442 Not that all is easy now, but recently a lot of gnu utilities have
1443 learned to react to LC_CTYPE=iso_8859_1 or LC_CTYPE=iso-8859-1. Try
1444 this first, and if it doesn't help look at the hints below. Note that
1445 in recent versions of libc the routine setlocale() only works if you
1446 have installed the locale files (e.g. in /usr/lib/locale).
1448 First of all, the 8-th bit should survive the kernel input processing,
1449 so make sure to have stty cs8 -istrip -parenb set.
1451 A. For emacs the details strongly depend on the version. The
1452 information below is for version 19.34. Put lines
1453 (set-input-mode nil nil 1)
1454 (standard-display-european t)
1455 (require 'iso-syntax)
1460 into your $HOME/.emacs. The first line (to be precise: the final 1)
1461 tells emacs not to discard the 8-th bit from input characters. The
1462 second line tells emacs not to display non-ASCII characters as octal
1463 escapes. The third line specifies the syntactic properties and case
1464 conversion table for the Latin-1 character set These last two lines
1465 are superfluous if you have something like LC_CTYPE=ISO-8859-1 in your
1466 environment. (The variable may also be LC_ALL or even LANG. The
1467 value may be anything with a substring `88591' or `8859-1' or
1470 This is a good start. On a terminal that cannot display non-ASCII ISO
1471 8859-1 symbols, the command
1474 (load-library "iso-ascii")
1479 will cause accented characters to be displayed comme {,c}a. If your
1480 keymap does not make it easy to produce non-ASCII characters, then
1483 (load-library "iso-transl")
1488 will make the 2-character sequence Ctrl-X 8 a compose character, so
1489 that the 4-character sequence Ctrl-X 8 , c produces c-cedilla. Very
1500 will toggle ISO-8859-1 accent mode, in which the six characters ', `,
1501 ", ^, ~, / are dead keys modifying the following symbol. Special com-
1502 binations: ~c gives a c with cedilla, ~d gives an Icelandic eth, ~t
1503 gives an Icelandic thorn, "s gives German sharp s, /a gives a with
1504 ring, /e gives an a-e ligature, ~< and ~> give guillemots, ~! gives an
1505 inverted exclamation mark, ~? gives an inverted question mark, and ''
1506 gives an acute accent. This is the default mapping of accents. The
1507 variable iso-languages is a list of pairs (language name, accent map-
1508 ping), and a non-default mapping can be selected using
1511 (iso-accents-customize LANGUAGE)
1516 Here LANGUAGE can be one of "portuguese", "irish", "french",
1517 "latin-2", "latin-1".
1519 Since the Linux default compose character is Ctrl-. it might be
1520 convenient to use that everywhere. Try
1523 (load-library "iso-insert.el")
1524 (define-key global-map [?\C-.] 8859-1-map)
1529 The latter line will not work under xterm, if you use emacs -nw, but
1530 in that case you can put
1533 XTerm*VT100.Translations: #override\n\
1534 Ctrl <KeyPress> . : string("\0308")
1539 in your .Xresources.)
1541 B. For less, put LESSCHARSET=latin1 in the environment. This is also
1542 what you need if you see \255 or <AD> in man output: some versions of
1543 less will render the soft hyphen (octal 0255, hex 0xAD) this way when
1544 not given permission to output Latin-1.
1546 C. For ls, give the option -N. (Probably you want to make an alias.)
1548 D. For bash (version 1.13.*), put
1552 set convert-meta off
1558 into your $HOME/.inputrc.
1564 setenv LC_CTYPE iso_8859_1
1569 If you have nls on your system, then the corresponding routines are
1570 used. Otherwise tcsh will assume iso_8859_1, regardless of the values
1571 given to LANG and LC_CTYPE. See the section NATIVE LANGUAGE SYSTEM in
1572 tcsh(1). (The Danish HOWTO says: setenv LC_CTYPE ISO-8859-1; stty
1575 F. For flex, give the option -8 if the parser it generates must be
1576 able to handle 8-bit input. (Of course it must.)
1578 G. For elm, set displaycharset to ISO-8859-1. (Danish HOWTO: LANG=C
1579 and LC_CTYPE=ISO-8859-1)
1581 H. For programs using curses (such as lynx) David Sibley reports: The
1582 regular curses package uses the high-order bit for reverse video mode
1583 (see flag _STANDOUT defined in /usr/include/curses.h). However,
1584 ncurses seems to be 8-bit clean and does display iso-latin-8859-1
1587 I. For programs using groff (such as man), make sure to use -Tlatin1
1588 instead of -Tascii. Old versions of the program man also use col, and
1589 the next point also applies.
1591 J. For col, make sure 1) that it is fixed so as to do
1592 setlocale(LC_CTYPE,""); and 2) put LC_CTYPE=ISO-8859-1 in the
1595 K. For rlogin, use option -8.
1598 metalab.unc.edu:/pub/Linux/apps/editors/joe-1.0.8-linux.tar.gz is said
1599 to work after editing the configuration file. Someone else said: joe:
1600 Put the -asis option in /isr/lib/joerc in the first column.
1602 M. For LaTeX: \documentstyle[isolatin]{article}. For LaTeX2e:
1603 \documentclass{article}\usepackage{isolatin} where isolatin.sty is
1604 available from ftp.vlsivie.tuwien.ac.at/pub/8bit.
1606 A nice discussion on the topic of ISO-8859-1 and how to manage 8-bit
1607 characters is contained in the file grasp.insa-
1608 lyon.fr:/pub/faq/fr/accents (in French). Another fine discussion (in
1609 English) can be found in rtfm.mit.edu:pub/usenet-by-
1610 group/comp.answers/internationalization/iso-8859-1-charset.
1612 If you need to fix a program that behaves badly with 8-bit characters,
1613 one thing to keep in mind is that if you have a signed char type then
1614 characters may be negative, and using them as an array index will
1615 fail. Several programs can be fixed by judiciously adding (unsigned
1622 This FAQ/HOWTO is about the Linux keyboard and console, not about X,
1623 which substitutes its own handling. However, it seems useful to
1624 document some of the Linux keyboard and console related properties of
1627 First of all, when X is started (say using startx or xinit) it opens
1628 the first unused console, unless the desired console has been
1629 indicated explicitly, as in xinit -- vt12. Note that this will fail
1630 when there is no device file /dev/tty12, but that it will not fail
1631 when the indicated console was in use already. When X finishes, it
1632 will return to the original console. While it is running one can use
1633 Ctrl-Alt-Fn to switch to VTn.
1635 The XFree86 keymap mechanism is much poorer than the Linux mechanism.
1636 For each keycode there are at most 4 symbols defined, namely for the 4
1637 keymaps plain, shift, mod, mod+shift. What is the modifier mod? It is
1638 the one designated by the symbol Mode_switch. For example, the
1639 command xmodmap keys.dk, where the file keys.dk contains
1642 keycode 64 = Mode_switch
1643 keycode 113 = Mode_switch
1644 keycode 38 = a A aring Aring
1645 keycode 26 = e E ae AE
1646 keycode 32 = o O oslash Ooblique
1651 will make both Alt keys into mod keys, so that Alt+a gives (a-ring),
1652 etc. (Note the illogical naming of oslash and Ooblique.) Such an
1653 xmodmap command can be placed in the .xinitrc shell script that is
1654 executed by default when X is started.
1657 1
\b13
\b3.
\b.1
\b1.
\b. W
\bWh
\bha
\bat
\bt p
\bpr
\bre
\bec
\bci
\bis
\bse
\bel
\bly
\by d
\bdo
\boe
\bes
\bs X
\bXF
\bFr
\bre
\bee
\be8
\b86
\b6-
\b-2
\b2.
\b.1
\b1 d
\bdo
\bo w
\bwh
\bhe
\ben
\bn i
\bit
\bt i
\bin
\bni
\bit
\bti
\bia
\bal
\bli
\biz
\bze
\bes
\bs i
\bit
\bts
\bs
1658 k
\bke
\bey
\bym
\bma
\bap
\bp?
\b?
1661 Since version 2.1, XFree86 will initialize its keymap from the Linux
1662 keymap, as far as possible. However, Linux had 16 entries per key (one
1663 for each combination of the Shift, AltGr, Ctrl, Alt modifiers) and
1664 presently has 256 entries per key, while X has 4 entries per key (one
1665 for each combination of Shift, Mod), so some information is
1668 First X reads the Xconfig file, where definitions of the LeftAlt,
1669 RightAlt, RightCtl, ScrollLock keys as Meta, ModeShift, Compose,
1670 ModeLock or ScrollLock might be found - see X386keybd(1), later
1673 For Mod the LeftAlt key is taken, unless RightCtl was defined as
1674 ModeShift or ModeLock, in which case RightCtl is taken, or RightAlt
1675 was so defined, in which case RightAlt is taken. This determines how
1676 the 4 XFree86 meanings of a key are selected from the 16 Linux
1677 meanings. Note that Linux today does not distinguish by default
1678 between the two Ctrl keys or between the two Shift keys. X does
1681 Now the kernel keymap is read and the usually obvious corresponding X
1682 bindings are made. The bindings for the "action keys" Show_Memory,
1683 Show_State, Show_Registers, Last_Console, Console_n, Scroll_Backward,
1684 Scroll_Forward, Caps_On and Boot are ignored, as are the dead
1685 diacriticals, and the locks (except for ShiftLock), and the "ASCII-x"
1688 Next, the definitions in the Xconfig file are used. (Thus, a
1689 definition of Compose in Xconfig will override its value as found in
1692 What happens to the strings associated with the function keys?
1693 Nothing, X does not have such a concept. (But it is possible to define
1694 strings for function keys in xterm - note however that the window
1695 manager gets the keys first.)
1697 I don't know how to convince xterm that it should use the X keymap
1698 when Alt is pressed; it seems just to look at its resource
1699 eightBitInput, and depending on whether that is true or false either
1700 set the high order bit of the character, or generate an additional
1701 Escape character (just like setmetamode(1) does for the console).
1704 1
\b14
\b4.
\b. U
\bUn
\bnu
\bus
\bsu
\bua
\bal
\bl k
\bke
\bey
\bys
\bs a
\ban
\bnd
\bd k
\bke
\bey
\byb
\bbo
\boa
\bar
\brd
\bds
\bs
1707 The two keys PrintScrn/SysRq and Pause/Break are special in that they
1708 have two keycodes: the former has keycode 84 when Alt is pressed
1709 simultaneously, and keycode 99 otherwise; the latter has keycode 101
1710 when Ctrl is pressed simultaneously, and keycode 119 otherwise.
1711 (Thus, it makes no sense to bind functions to Alt keycode 99 or Ctrl
1714 If you have strange keys, that do not generate any code under Linux
1715 (or generate messages like "unrecognized scancode"), and your kernel
1716 is 1.1.63 or later, then you can use setkeycodes(1) to tell the kernel
1717 about them. They won't work under X, however. Once they have gotten a
1718 keycode from setkeycodes, they can be assigned a function by loadkeys.
1721 1
\b15
\b5.
\b. E
\bEx
\bxa
\bam
\bmp
\bpl
\ble
\bes
\bs o
\bof
\bf u
\bus
\bse
\be o
\bof
\bf l
\blo
\boa
\bad
\bdk
\bke
\bey
\bys
\bs a
\ban
\bnd
\bd x
\bxm
\bmo
\bod
\bdm
\bma
\bap
\bp
1724 Switching Caps Lock and Control on the keyboard (assuming you use
1725 keymaps 0-15; check with dumpkeys | head -1)
1730 keycode 58 = Control
1731 keycode 29 = Caps_Lock
1737 Switching them under X only:
1740 % xmodmap .xmodmaprc
1745 where .xmodmaprc contains lines
1748 remove Lock = Caps_Lock
1749 remove Control = Control_L
1750 keysym Control_L = Caps_Lock
1751 keysym Caps_Lock = Control_L
1752 add Lock = Caps_Lock
1753 add Control = Control_L
1758 What is this about the key numbering? Backspace is 14 under Linux, 22
1759 under X? Well, the numbering can best be regarded as arbitrary; the
1760 Linux number of a key can be found using showkey(1), and the X number
1761 using xev(1). Often the X number will be 8 more than the Linux number.
1763 Something else people like to change are the bindings of the function
1764 keys. Suppose that you want to make F12 produce the string "emacs ".
1770 string F12 = "emacs "
1776 will do this. More explicitly, the procedure is like this: (i) find
1777 the keycodes of the keys to be remapped, using showkey(1). (ii) save
1778 the current keymap, make a copy and edit that:
1783 % dumpkeys > my_keymap
1784 % cp my_keymap trial_keymap
1785 % emacs trial_keymap
1786 % loadkeys trial_keymap
1792 The format of the table can be guessed by looking at the output of
1793 dumpkeys, and is documented in keymaps(5). When the new keymap func-
1794 tions as desired, you can put an invocation
1797 loadkeys my_new_keymap
1802 in /etc/rc.local or so, to execute it automatically at boot-up. Note
1803 that changing modifier keys is tricky, and a newbie can easily get
1804 into a situation only an expert can get out of.
1806 The default directory for keymaps is /usr/lib/kbd/keymaps. The
1807 default extension for keymaps is .map. For example, loadkeys uk would
1808 probably load /usr/lib/kbd/keymaps/i386/qwerty/uk.map. (With kbd-0.95
1809 and older this would be /usr/lib/kbd/keytables and
1810 /usr/lib/kbd/keytables/uk.map.)
1813 (On my machine) /dev/console is a symbolic link to /dev/tty0, and the
1814 kernel regards /dev/tty0 as a synonym for the current VT. XFree86 1.3
1815 changes the owner of /dev/tty0, but does not reset this after
1816 finishing. Thus, loadkeys or dumpkeys might fail because someone else
1817 owns /dev/tty0; in such a case you might run X first. Note that you
1818 cannot change keyboard mappings when not at the console (and not
1822 1
\b15
\b5.
\b.1
\b1.
\b. `
\b`I
\bI c
\bca
\ban
\bn u
\bus
\bse
\be o
\bon
\bnl
\bly
\by o
\bon
\bne
\be f
\bfi
\bin
\bng
\bge
\ber
\br t
\bto
\bo t
\bty
\byp
\bpe
\be w
\bwi
\bit
\bth
\bh'
\b'
1825 "Can the Shift, Ctrl and Alt keys be made to behave as toggles?"
1832 keycode 29 = Control_Lock
1833 keycode 42 = Shift_Lock
1834 keycode 56 = Alt_Lock
1840 the left Control, Shift and Alt keys will act as toggles. The numbers
1841 involved are revealed by showkey (and usually are 29, 97, 42, 54, 56,
1842 100 for left and right control, shift and alt, respectively), and the
1843 functions are Control_Lock, Shift_Lock, Alt_Lock, ALtGr_Lock.
1845 "What about `sticky' modifier keys?"
1847 Since version 1.3.33, the kernel knows about `sticky' modifier keys.
1848 These act on the next key pressed. So, where one earlier needed the
1849 3-symbol sequence Shift_Lock a Shift_Lock to type `A', one can now use
1850 the 2-symbol sequence SShift_Lock a. Versions of the kbd package
1851 older than 0.93 do not yet include code for these sticky modifiers,
1852 and have to invoke them using their hexadecimal codes. For example,
1859 keycode 100 = 0x0c03
1865 will make the right Shift, Ctrl, Alt sticky versions of the left ones.
1866 From 0.93 on you can say
1879 to obtain the same result. This will allow you to type Ctrl-Alt-Del
1880 in three keystrokes with one hand.
1882 The keymaps line in these examples should cover all keymaps you have
1883 in use. You find what keymaps you have in use by
1886 % dumpkeys | head -1
1892 1
\b16
\b6.
\b. C
\bCh
\bha
\ban
\bng
\bgi
\bin
\bng
\bg t
\bth
\bhe
\be v
\bvi
\bid
\bde
\beo
\bo m
\bmo
\bod
\bde
\be
1895 As far as I know there are 6 ways to change resolution:
1897 1. At compile time: change the line
1900 SVGA_MODE= -DSVGA_MODE=NORMAL_VGA
1905 in /usr/src/linux/Makefile.
1907 1A. After compilation: use rdev -v - a terrible hack, but it exists.
1909 2. At boot time: put vga=ask in the lilo config file, and lilo will
1910 ask you what video mode you want. Once you know, put vga=mypreference.
1912 3. At run time: A. Use the resizecons command. (This is a very
1913 primitive wrapper around the VT_RESIZE ioctl.) B. Use the
1914 SVGATextMode command. (This is a less primitive wrapper around the
1917 4. Not "on the console": Under dosemu, or with svgalib etc. you can
1918 change the hardware video mode without the console driver being aware
1919 of it. Sometimes this is useful in getting resizecons or SVGATextMode
1920 set up: use dosemu and some DOS program to get into the desired
1921 videomode, dump (say from another VT) the contents of all video
1922 hardware registers, and use that in the initialization that resizecons
1923 and SVGATextMode require. In some cases where the video mode has
1924 gotten into some unusable state, starting dosemu, relying on the BIOS
1925 to set up the video mode, and then killing dosemu (with kill -9), is
1926 the easiest way to get into shape again.
1929 1
\b16
\b6.
\b.1
\b1.
\b. I
\bIn
\bns
\bst
\btr
\bru
\buc
\bct
\bti
\bio
\bon
\bns
\bs f
\bfo
\bor
\br t
\bth
\bhe
\be u
\bus
\bse
\be o
\bof
\bf r
\bre
\bes
\bsi
\biz
\bze
\bec
\bco
\bon
\bns
\bs
1932 Get svgalib and compile the program restoretextmode. Boot up your
1933 machine in all possible video modes (using vga=ask in the lilo config
1934 file), and write the video hardware register contents to files CxR
1935 (C=cols, R=rows), e.g., 80x25, 132x44, etc. Put these files in
1936 /usr/lib/kbd/videomodes. Now resizecons 132x44 will change videomode
1937 for you (and send SIGWINCH to all processes that need to know about
1938 this, and load another font if necessary).
1940 At present, resizecons only succeeds when there is memory enough for
1941 both the old and the new consoles at the same time.
1944 1
\b17
\b7.
\b. C
\bCh
\bha
\ban
\bng
\bgi
\bin
\bng
\bg t
\bth
\bhe
\be k
\bke
\bey
\byb
\bbo
\boa
\bar
\brd
\bd r
\bre
\bep
\bpe
\bea
\bat
\bt r
\bra
\bat
\bte
\be
1947 At startup, the Linux kernel sets the repeat rate to its maximal
1948 value. For most keyboards this is reasonable, but for some it means
1949 that you can hardly touch a key without getting three copies of the
1950 corresponding symbol. Use the program kbdrate(8) to change the repeat
1951 rate, or, if that doesn't help, edit or remove the section
1953 ______________________________________________________________________
1954 ! set the keyboard repeat rate to the max
1957 xor bx,bx ! clear bx
1959 ______________________________________________________________________
1962 of /usr/src/linux/[arch/i386/]boot/setup.S.
1964 Scott Johnston (sj@zule.com) reports: `To program the repeat rate of a
1965 Gateway AnyKey keyboard all one has to do is press the "Repeat Rate"
1966 key, then a function key F1-F8, then "Repeat Rate" again. F1 is the
1967 slowest possible repeat rate, and F8 is really fast. If you somehow
1968 manage to mess up your AnyKey keyboard doing this, simply press Ctrl-
1969 Alt-SuspndMacro to reset your keyboard to factory default settings.'
1972 1
\b18
\b8.
\b. S
\bSc
\bcr
\bro
\bol
\bll
\bli
\bin
\bng
\bg
1975 There are two ways to get a screen to scroll. The first, called `hard
1976 scrolling', is to leave the text in video memory as it is, but change
1977 the viewing origin. This is very fast. The second, called `soft
1978 scrolling', involves moving all screen text up or down. This is much
1979 slower. The kernel console driver will write text starting at the top
1980 of the video memory, continuing to the bottom, then copy the bottom
1981 part to the top again, and continue, all the time using hard scrolling
1982 to show the right part on the screen. You can scroll back until the
1983 top op the video memory by using Shift-PageUp (the grey PageUp) and
1984 scroll down again using Shift-PageDown (the grey PageDown), assuming a
1985 default keymap. The amount of scrollback is thus limited to the
1986 amount of video memory you happen to have and you cannot increase this
1987 amount. If you need more scrollback, use some program that buffers
1988 the text, like less or screen - by using a buffer on disk you can go
1989 back to what you did last week. (One can set the amount of scrollback
1990 for xterm by adding a line like XTerm*saveLines: 2500 in .Xresources.)
1992 Upon changing virtual consoles, the screen content of the old VT is
1993 copied to kernel memory, and the screen content of the new VT is
1994 copied from kernel memory to video memory. Only the visible screen is
1995 copied, not all of video memory, so switching consoles means losing
1996 the scrollback information.
1998 Sometimes, hard scrolling is undesirable, for example when the
1999 hardware does not have the possibility to change viewing origin. The
2000 first example was a Braille machine that would render the top of video
2001 memory in Braille. There is a kernel boot-time option no-scroll to
2002 tell the console driver not to use hard scrolling. See bootparam(7).
2005 1
\b19
\b9.
\b. S
\bSc
\bcr
\bre
\bee
\ben
\bns
\bsa
\bav
\bvi
\bin
\bng
\bg
2008 setterm -blank _
\bn_
\bn will tell the console driver to blank the screen
2009 after _
\bn_
\bn minutes of inactivity. (With _
\bn_
\bn = 0, screensaving is turned
2010 off. In some old kernels this first took effect after the next
2011 keyboard interrupt.)
2013 The s option of xset(1) will set the X screensaving parameters: xset s
2014 off turns off the screensaver, xset s 10 blanks the screen after 10
2017 The video hardware powersaving modes can be enabled/disabled using the
2018 setvesablank program given in the starting comment of
2019 /usr/src/linux/drivers/char/vesa_blank.c.
2022 2
\b20
\b0.
\b. S
\bSc
\bcr
\bre
\bee
\ben
\bn d
\bdu
\bum
\bmp
\bps
\bs
2025 setterm -dump _
\bN will dump the contents of the screen of /dev/tty_
\bN to a
2026 file screen.dump in the current directory. See setterm(1).
2028 The current contents of the screen of /dev/tty_
\bN can be accessed using
2029 the device /dev/vcs_
\bN (where `vcs' stands for `virtual console
2030 screen'). For example, you could have a clock program that displays
2031 the current time in the upper right hand corner of the console screen
2032 (see the program vcstime in kbd-0.99.tar.gz). Just dumping the
2033 contents goes with cat /dev/vcs_
\bN. These device files /dev/vcs_
\bN do not
2034 contain newlines, and do not contain attributes, like colors. From a
2035 program it is usually better to use /dev/vcsa_
\bN (`virtual console
2036 screen with attributes') instead - it starts with a header giving the
2037 number of rows and columns and the location of the cursor. See
2041 2
\b21
\b1.
\b. S
\bSo
\bom
\bme
\be p
\bpr
\bro
\bop
\bpe
\ber
\brt
\bti
\bie
\bes
\bs o
\bof
\bf t
\bth
\bhe
\be V
\bVT
\bT1
\b10
\b00
\b0 -
\b- a
\bap
\bpp
\bpl
\bli
\bic
\bca
\bat
\bti
\bio
\bon
\bn k
\bke
\bey
\by m
\bmo
\bod
\bde
\be
2044 : Sometimes my cursor keys or keypad keys produce strange codes?
2047 When the terminal is in application cursor key mode the cursor keys
2048 produce Esc O x and otherwise Esc [ x where x is one of A,B,C,D.
2049 Certain programs put the terminal in application cursor key mode; if
2050 you kill them with kill -9, or if they crash, then the mode will not
2056 resets all properties of the current VC. Just changing the cursor
2057 application key mode is done by
2059 % echo -e '\033[?1h'
2064 % echo -e '\033[?1l'
2069 When the terminal is in application keypad key mode the keypad keys
2070 produce Esc O y and otherwise Esc [ z ~ for certain y and z.
2071 Setting application keypad key mode is done by
2084 2
\b22
\b2.
\b. H
\bHa
\bar
\brd
\bdw
\bwa
\bar
\bre
\be i
\bin
\bnc
\bco
\bom
\bmp
\bpa
\bat
\bti
\bib
\bbi
\bil
\bli
\bit
\bty
\by
2087 Several people have noticed that they lose typed characters when a
2088 floppy disk is active. It seems that this might be a problem with
2089 Uni-486WB motherboards.
2091 Tjalling Tjalkens (tjalling@ei.ele.tue.nl) reports very similar
2092 problems with "a no-brand GMB-486 UNP Vesa motherboard with AMD
2093 486DX2-66 CPU" - during floppy activity some keystrokes are lost,
2094 during floppy tape streamer (Conner C 250 MQ) activity many keystrokes
2097 Some people experience sporadic lockups - sometimes associated to hard
2098 disk activity or other I/O.
2100 Ulf Tietz (ulf@rio70.bln.sni.de) wrote: `I have had the same problems,
2101 when I had my motherboard tuned too fast. So I reset all the timings
2102 ( CLK, wait statements etc ) to more conventional values, and the
2105 Bill Hogan (bhogan@crl.com) wrote: `If you have an AMI BIOS, you might
2106 try setting the Gate A20 emulation parameter to "chipset" (if you have
2107 that option). Whenever I have had that parameter set to any of the
2108 other options on my machine ("fast", "both", "disabled") I have had
2109 frequent keyboard lockups.'
2111 There may be a relation between keyboard problems and the video card
2113 Shawn K. Quinn (skquinn@wt.net) wrote: `I have a Zeos Pantera
2114 Pentium-90 that originally came with a Diamond Stealth 64 S3-based
2115 video card. Under X I frequently got q's inserted into my text (how
2116 annoying) especially if I typed very fast (during Netrek for instance,
2117 even more annoying because guess what that does :-( ). Switching to a
2118 Creative Labs Graphics Blaster MA202 solved the problem. I'm assuming
2119 the Stealth 64 did something funny with the timings.'
2122 2
\b23
\b3.
\b. C
\bCo
\bop
\bpy
\byr
\bri
\big
\bgh
\bht
\bt
2124 Copyright (c) 1993-1999 by Andries Brouwer. This document may be
2125 distributed under the terms set forth in the LDP license at
2126 http://metalab.unc.edu/LDP/COPYRIGHT.html or
2127 ftp://www.win.tue.nl/pub/linux/LDP/COPYRIGHT.txt.
2129 Additions and corrections are welcome. Andries Brouwer - aeb@cwi.nl