Consistent Keyboard Configuration
Now start X as root. Change the directory to /etc/X11 and look at the file Xmodmap. Most likely, this file is empty, except for some comments. If not, rename it to Xmodmap.old, exit the window manager and restart X.
Starting with an empty Xmodmap is important, because when X comes up, it creates its keyboard modifier map and keymap table based on the kernel's current keyboard translation tables, which were just reconfigured. X then reads the Xmodmap file, which overrides the kernel. This could destroy some of the benefits of the work just completed on the kernel.
Since the kernel has already been reconfigured, the work of configuring X will be reduced by the work already done in creating custom.map. Specifically, DELETE and BACKSPACE will still transmit DELETE and BACKSPACE, because X got that information from the kernel.
Now enter the following command to replace Xmodmap with the current keymap table:
# xmodmap -pke > /etc/X11/Xmodmap
Edit Xmodmap. It appears similar to the file custom.map, but do not be misled. The keycodes are different. To find the keycode number for a given key, run xev from an xterm, put the mouse cursor inside the xev window, and press the key. Look for the key's “keycode” in the output. For more information, see xev(1) and xmodmap(1).
Finally, to switch the Caps Lock and the left CTRL key, add these lines to the end of the file:
! Recreate the Lock and Control modifier maps. clear Lock clear Control add Lock = Caps_Lock add Control = Control_L Control_R
To be able to configure keys on the numeric keypad, they must be given an appropriate keysym following the equals sign. Therefore, change the following lines as shown:
keycode 63 = KP_Multiply keycode 77 = KP_F1 keycode 79 = KP_7 keycode 80 = KP_8 keycode 81 = KP_9 keycode 82 = KP_Subtract keycode 83 = KP_4 keycode 84 = KP_5 keycode 85 = KP_6 keycode 86 = KP_Add keycode 87 = KP_1 keycode 88 = KP_2 keycode 89 = KP_3 keycode 90 = KP_0 keycode 91 = KP_Decimal keycode 108 = KP_Enter keycode 112 = KP_DivideKeycodes 99 and 105 are assigned to the keysyms Prior and Next, respectively. Just as was done in custom.map, change them to the following keysyms, which are functionally equivalent, but match the keycaps:
keycode 99 = Page_Up keycode 105 = Page_DownNow save the file, then type:
# xmodmap /etc/X11/Xmodmapto activate the new definitions. If your keyboard will not work at all, use CTRL-ALT-BACKSPACE to exit X. Then use a virtual console to fix the problem.
The xterm program receives keysyms from X and converts them into characters and into escape sequences. Since xterm emulates a VT102 terminal, it requires little configuration work.
Edit the /etc/X11/Xresources file, and add the following line:
XTerm*ttyModes: erase ^H
This automatically makes BACKSPACE (CTRL-H) delete characters to the left of the cursor. It is the same as if the user typed:
$ stty erase ^Hevery time an xterm was started. Also add this line:
XTerm*appkeypadDefault: trueThis will cause the keys of the numeric keypad to transmit their escape sequences instead of numbers, operators, etc. It is the same as if the user pressed CTRL--MiddleButton and selected “Enable Application Keypad” in every xterm window.
Unfortunately, Emacs normally resets the numeric keypad when it exits, so the keys no longer transmit escape sequences. To correct this behavior, the “rmkx” capability must be removed from the terminfo(5) database:
# cd /etc/terminfo/x # infocmp xterm > xterm.txt # emacs xterm.txt
Remove the “rmkx” entry, save the file, and exit. Then:
# tic xterm.txt # rm xterm.txtIt is also necessary to tell xterm what the ALT-Arrow keys transmit, and what the HOME and END editing keys transmit. (The default escape sequences that xterm uses for HOME and END are unconventional.) Type the first seven lines below. Then cut and paste the remaining lines from the xterm(1) man page, underneath the heading, “The default bindings in the VT102 window are.”
XTerm*VT100*translations:\\
Alt <KeyPress> Up:string(0x1b) string(0x1b) string("OA")
Alt <KeyPress> Down:string(0x1b) string(0x1b) string("OB") \\n\\
Alt <KeyPress> Right:string(0x1b) string(0x1b) string("OC") \\n\\
Alt <KeyPress> Left:string(0x1b) string(0x1b) string("OD") \\n\\
<KeyPress> Home:string(0x1b) string("[1~") \\n\\
<KeyPress> End:string(0x1b) string("[4~") \\n\\
Shift <KeyPress> \
Prior:scroll-back(1,halfpage) \\n\\
Shift <KeyPress> \
Next:scroll-forw(1,halfpage) \\n\\
Shift <KeyPress> \
Select:select-cursor-start() \\n\\
Shift <KeyPress> select-cursor-end(PRIMARY, \
CUT_BUFFER0) \\n\\
Shift <KeyPress> Insert:insert-selection(PRIMARY,\
CUT_BUFFER0) \\n\\
~Meta<KeyPress>:insert-seven-bit() \\n\\
Meta<KeyPress>:insert-eight-bit() \\n\\
!Ctrl <Btn1Down>:popup-menu(mainMenu) \\n\\
!Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \\n\\
!Mod2 Ctrl <Btn1Down>:popup-menu(mainMenu) \\n\\
!Mod2 Lock Ctrl \
<Btn1Down>:popup-menu(mainMenu) \\n\\
~Meta <Btn1Down>:select-start() \\n\\
~Meta <Btn1Motion>:select-extend() \\n\\
!Ctrl <Btn2Down>:popup-menu(vtMenu) \\n\\
!Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \\n\\
!Mod2 Ctrl <Btn2Down>:popup-menu(vtMenu) \\n\\
!Mod2 Lock Ctrl \
<Btn2Down>:popup-menu(vtMenu) \\n\\
~Ctrl ~Meta <Btn2Down>:ignore() \\n\\
~Ctrl ~Meta <Btn2Up>:insert-selection(PRIMARY, CUT_BUFFER0) \\n\\
!Ctrl <Btn3Down>:popup-menu(fontMenu) \\n\\
!Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \\n\\
!Mod2 Ctrl <Btn3Down>:popup-menu(fontMenu) \\n\\
!Mod2 Lock Ctrl \
<Btn3Down>:popup-menu(fontMenu) \\n\\
~Ctrl ~Meta <Btn3Down>:start-extend() \\n\\
~Meta <Btn3Motion>:select-extend() \\n\\
<BtnUp>>>>>>>>:select-end(PRIMARY, CUT_BUFFER0) \\n\\
<BtnDown>:bell(0)
Make sure each line ends exactly as shown, and there is not even a
blank space after the last backslash on each line. Then change
“Prior” to “Page_Up,” change “Next” to “Page_Down,” and
change “Select” to “End” to match the keycaps.
ALT-Arrow transmits an ESCAPE (0x1b in hexadecimal) followed by the escape sequence for the arrow key, but ALT-<Keypress> sets the eighth bit of that key (examine the line that begins with “Meta<KeyPress>”). Also, the escape sequences for the ALT-arrow keys are not the same as were used in custom.map. For a full explanation of this file's format, see the RESOURCES heading under X(1). Save the file. Type:
# xrdb /etc/X11/Xresources
to activate the definitions. The BACKSPACE key should now work properly the next time an xterm is started.
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?
- Dart: a New Web Programming Experience
- Developer Poll
- What's the tweeting protocol?
- May 2013 Issue of Linux Journal: Raspberry Pi
- Reply to comment | Linux Journal
1 hour 43 min ago - Reply to comment | Linux Journal
3 hours 49 sec ago - great post
3 hours 35 min ago - Google Docs
3 hours 58 min ago - Reply to comment | Linux Journal
8 hours 46 min ago - Reply to comment | Linux Journal
9 hours 33 min ago - Web Hosting IQ
11 hours 7 min ago - Thanks for taking the time to
12 hours 43 min ago - Linux is good
14 hours 41 min ago - Reply to comment | Linux Journal
14 hours 58 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.