Consistent Keyboard Configuration
First, the kernel's keyboard translation tables will be redefined. Since these tables are not used directly by the X Window System, use one of the virtual consoles, not a window manager. Log in as root or use su. Different distributions of Linux may load the translation tables in different ways. To determine which keyboard translation table is in use, type:
# find /etc -type f | xargs grep loadkeys
You should see output something like:
/etc/init.d/boot: loadkeys \
/usr/lib/kbd/keytables/us.map
which would indicate that the U.S. translation table is in use.
Assuming the U.S. translation table is in use, enter the following commands to make a copy of it:
# cd /usr/lib/kbd/keytables # cp us.map custom.map
The format of keyboard table files is given in keytables(5).
Now edit custom.map using any text editor. Find the following lines:
keycode 14 = Delete Delete
alt keycode 14 = Meta_Delete
These lines specify that when keynumber 14 is pressed (the BACKSPACE key), send a DELETE to the system, and when ALT-BACKSPACE is pressed, send a Meta_DELETE. To find out the keynumber of any key, use the showkey command.
To make the BACKSPACE key conform to the design decisions, change these lines to read:
keycode 14 = BackSpace BackSpace
alt keycode 14 = Meta_BackSpace
However, a delete key is also needed, so replace the following line:
keycode 111 = Removewith these two lines:
keycode 111 = Delete Delete
alt keycode 111 = Meta_Delete
Keynumber 111 is the DELETE key on the editing keypad, just below
the INSERT key.
Now, to swap Caps_Lock with the left CTRL key, redefine keycodes 29 and 58 as follows:
keycode 29 = Caps_Lock # Left Control key. keycode 58 = Control # Caps Lock key.
Configuring the numeric keypad presents a special challenge. In us.map, several of the keys transmit the same escape sequences as an editing key. This makes it impossible, for example, for a program to distinguish between the PAGE UP key on the editing keypad and the 9/Pg Up key on the numeric keypad. Furthermore, the NUM LOCK, /, *, - and + keys do not even transmit escape sequences.
To alleviate these problems, the virtual console's numeric keypad will be configured somewhat like a VT100 numeric keypad. Since xterm already emulates a VT102, this will save work by making the virtual consoles more compatible with xterm. Note that this technique could cause incompatibilities with software programs that expect the keys to behave as defined by us.map. If this becomes a problem, the keys can always be switched back.
To be able to configure the keys of the numeric keypad independently, they will have to be changed into function keys. Since the kernel supports up to 246 function keys, F1 through F246, this is not a problem. Redefine the following keycodes as shown:
keycode 55 = F112 # Numeric keypad *. keycode 69 = F110 # NumLock. keycode 71 = F107 # Numeric keypad 7. keycode 72 = F108 # Numeric keypad 8. keycode 73 = F109 # Numeric keypad 9. keycode 74 = F113 # Numeric keypad -. keycode 75 = F104 # Numeric keypad 4. keycode 76 = F105 # Numeric keypad 5. keycode 77 = F106 # Numeric keypad 6. keycode 78 = F114 # Numeric keypad +. keycode 79 = F101 # Numeric keypad 1. keycode 80 = F102 # Numeric keypad 2. keycode 81 = F103 # Numeric keypad 3. keycode 82 = F100 # Numeric keypad 0. keycode 83 = F116 # Numeric keypad .. keycode 96 = F115 # Numeric keypad Enter. keycode 98 = F111 # Numeric keypad /.
Furthermore, it is necessary to define the escape sequences that these keys transmit, so add these lines to the end of the file:
string F100 = "\\033Op" string F101 = "\\033Oq" string F102 = "\\033Or" string F103 = "\\033Os" string F104 = "\\033Ot" string F105 = "\\033Ou" string F106 = "\\033Ov" string F107 = "\\033Ow" string F108 = "\\033Ox" string F109 = "\\033Oy" string F110 = "\\033OP" string F111 = "\\033Oo" string F112 = "\\033Oj" string F113 = "\\033Om" string F114 = "\\033Ok" string F115 = "\\033OM" string F116 = "\\033On""\\033" is the octal representation of ESCAPE. These are the same escape sequences that will be transmitted by these keys when running xterm, after following the remaining steps.
Although function keys F6 through F12 are compatible with xterm, F1 through F5 are not. To fix this, add these lines:
string F1 = "\\033[11~" string F2 = "\\033[12~" string F3 = "\\033[13~" string F4 = "\\033[14~" string F5 = "\\033[15~"
It is recommended that the following keycodes be defined so the keysyms (the names following the equals signs) will match the keycaps. However, this will not change the escape sequences transmitted, since these keysyms are only synonyms for the original keysyms:
keycode 102 = Home # Was Find. keycode 104 = PageUp # Was Prior. keycode 107 = Enc # Was Select. keycode 109 = PageDown # Was Next.One very nice feature is to be able to hold down the ALT key while using the arrow keys to pan within Emacs. Since ALT-Left and ALT-Right were previously used to switch virtual consoles, those functions will be remapped to CTRL-Left and CTRL-Right.
Change these two lines as shown:
# Ctrl-Left (was Alt) control keycode 105 = Decr_Console # Ctrl-Right (was Alt) control keycode 106 = Incr_Console
And add the following lines:
alt keycode 103 = F117 # Left Alt-Up Arrow altgr keycode 103 = F117 # Right Alt-Up Arrow alt keycode 105 = F120 # Left Alt-Left Arrow altgr keycode 105 = F120 # Right Alt-Left Arrow alt keycode 106 = F119 # Left Alt-Right Arrow altgr keycode 106 = F119 # Right Alt-Right Arrow alt keycode 108 = F118 # Left Alt-Down Arrow altgr keycode 108 = F118 # Right Alt-Down Arrow string F117 = "\\033\\033[A" # Alt-Up Arrow string F118 = "\\033\\033[B" # Alt-Down Arrow string F119 = "\\033\\033[C" # Alt-Right Arrow string F120 = "\\033\\033[D" # Alt-Left ArrowNote ALT-arrow transmits an ESCAPE followed by the normal escape sequence for the arrow key.
Of course, CTRL-ALT-DELETE will reboot Linux, but what if the user is finished for the day and wants a quick shutdown? To make CTRL-ALT-H-END shut down Linux, add the following lines:
# Numeric keypad End control alt keycode 79 = KeyboardSignal control altgr keycode 79 = KeyboardSignal # Editing keypad End control alt keycode 107 = KeyboardSignal control altgr keycode 107 = KeyboardSignal
Then save the file, and edit /etc/inittab. Add or edit the following lines as shown:
# Action on special keypress (CTRL-ALT-END). kb::kbrequest:/sbin/shutdown -h nowSave the file, and everything is ready to be tested. Type:
# loadkeys custom.mapand try the new keys. DELETE should act as BACKSPACE did before. Caps Lock has been switched with the left CTRL key. Exit all programs, then try CTRL-ALT-END. After shutdown, use the hardware reset button to reboot.
If the keyboard passed these basic tests, us.map can be replaced with custom.map. Regular users may encounter errors when running loadkeys, because it requires read access to /dev/console. Furthermore, different users using different maps could cause confusion. Therefore, it is suggested the new keymap be permanently installed on the system by root.
Warning: If these installation instructions are not followed correctly, it is possible to place the keyboard in an unusable state, forcing the user to reboot from the installation floppies. Please take any necessary precautions before proceeding.
To install custom.map permanently, edit /etc/init.d/boot, or whichever boot script contains the loadkeys command, and add the following line to the top of the file:
custom_keys=/usr/lib/kbd/keytables/custom.map
Then replace the loadkeys command with:
if [ -f $custom_keys ] # If custom keys exist, then # then load them. loadkeys $custom_keys else # Else use the regular keys. loadkeys /usr/lib/kbd/keytables/us.map fiThis way, if custom.map somehow gets deleted, the keyboard will still work. Run this script to make sure it is correct. If it works, the new keymap will be automatically activated at the next system boot.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- RSS Feeds
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Home, My Backup Data Center
- A Topic for Discussion - Open Source Feature-Richness?
- Developer Poll
- Dart: a New Web Programming Experience
- May 2013 Issue of Linux Journal: Raspberry Pi
- What's the tweeting protocol?
- Reply to comment | Linux Journal
2 hours 43 min ago - Reply to comment | Linux Journal
3 hours 30 min ago - Web Hosting IQ
5 hours 4 min ago - Thanks for taking the time to
6 hours 41 min ago - Linux is good
8 hours 38 min ago - Reply to comment | Linux Journal
8 hours 56 min ago - Web Hosting IQ
9 hours 26 min ago - Web Hosting IQ
9 hours 26 min ago - Web Hosting IQ
9 hours 27 min ago - Reply to comment | Linux Journal
12 hours 27 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




Comments
Ctrl-m in emacs
How can I bind Ctrl-m to some command, in emacs, without binding return to that command. So how can I separate Ctrl-m from return ? And not using X. Cause I use emacs over ssh.
Thanks
Re: Consistent Keyboard Configuration
Nice.
However, what do you do if the loadkeys command isn't present?
Ditto for the find command.