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.mapwhich 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_DeleteKeynumber 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:
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.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- SUSE LLC's SUSE Manager
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- My +1 Sword of Productivity
- Managing Linux Using Puppet
- Non-Linux FOSS: Caffeine!
- Doing for User Space What We Did for Kernel Space
- SuperTuxKart 0.9.2 Released
- Parsing an RSS News Feed with a Bash Script
- Google's SwiftShader Released
- Rogue Wave Software's Zend Server
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide