Consistent Keyboard Configuration
One of the convenient features of Linux is that the keyboard can be completely reconfigured to suit personal tastes. This feature can be a blessing or a curse when keys do not perform the same actions in all applications, but with a little work you can program any key to perform almost any task. Inconsistent keyboard behavior can be eliminated, and applications customized as desired.
In this article, you learn how to achieve consistent behavior for the BACKSPACE, DELETE and ALT keys. The Caps Lock key is switched with the left CTRL key to make the typing of control characters easier. The keys of the editing keypad are configured to perform as labeled. Function keys, and some keys of the numeric keypad, are programmed to perform arbitrary tasks. A shutdown key is also configured.
The keyboard configuration techniques will be demonstrated by a wide range of examples, one program at a time. Where practical, these techniques will be demonstrated for bash, less, Netscape, minicom and Emacs. Furthermore, the keyboard will be made to work as desired, regardless of whether the application is running in an xterm window, in a virtual console, or in an X11 window manager. However, it is assumed that the user has an IBM PC-compatible keyboard.
An IBM PC-compatible keyboard is divided into five blocks of keys. The alphabetic keys and those surrounding them form the main keypad. To the immediate right of the main keypad are two small sets of keys. The upper six keys are the editing keys; the lower four keys are the arrow keys, which are also called cursor control keys. At the far right is the numeric keypad. Finally, the function keys stretch in a single line across the top of the keyboard.
When a function key or an arrow key is pressed, an escape sequence is normally transmitted by the key. An escape sequence is a string of a few characters, the first of which is an ESCAPE control code. The rest of the string is used to distinguish one key from another.
The VT100 family is a set line of text-only display terminals once manufactured by Digital Equipment Corporation. The VT100 has become the de facto standard for ASCII terminals. Its successor, the VT200, is compatible with the VT100 family. However, VT200s also have a row of twenty function keys and six editing keys that the VT100s did not have. The VT200 keyboard is somewhat similar to the IBM PC-style keyboard that is now in general use.
A keypress event occurs when the user presses any key on the keyboard. The event passes through various software programs, eventually resulting in some sort of action (see Figure 1). Ideally, the same keypress will result in a similar action in all programs, thus reducing the user's confusion.
For example, suppose a user is running Emacs inside an xterm under the X Window System and presses the up arrow key. Referring again to Figure 1, the up arrow is pressed, resulting in an event keycode of 98 being generated, which uniquely identifies that key. The X Window System translates this keycode into the “Up” keysym, which is received by the xterm. The xterm then translates the “Up” keysym into the three-character escape sequence “\\eOA” (“\\e” represents the ASCII ESCAPE control code). Emacs receives “\\eOA” as a series of three input events, which are then translated by the function-key-map into the vector [up]. The vector [up] passes unchanged through the key-translation-map. Finally, the global-map maps [up] to the previous-line command, which moves the cursor up one line in the buffer.
One way to approach configuring the BACKSPACE and DELETE keys is to let them act as they do in DOS and MS Windows. That is, BACKSPACE erases the character to the left of the cursor, and DELETE erases the character under the cursor. This is a very convenient arrangement.
It is also a good idea to decide what control codes should be transmitted when these keys are pressed. Based on the key labels, let the BACKSPACE key transmit a BACKSPACE (ASCII code 8, 010 in octal, 0x08 in hexadecimal, CTRL-H), and let the DELETE key transmit a DELETE (ASCII code 127, 177 in octal, 7F in hexadecimal). Simple solutions are usually the best.
The ALT key, which acts somewhat like a shift key, can be configured in one of two ways. Either it can set the eighth bit of the key being pressed with it, or it can cause an ESCAPE to be transmitted just before the key being pressed with it. Both methods will be used at different times. Sometimes it is simpler to configure the ALT key to transmit an ESCAPE. For example, holding down ALT while pressing A would cause the string “\\eA” to be transmitted. However, at other times it will be configured to set the eighth bit of the character being pressed, thus adding 128 to the ASCII code of that character. Meta is a synonym for ALT.
Practical Task Scheduling Deployment
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.View Now!
|The Firebird Project's Firebird Relational Database||Jul 29, 2016|
|Stunnel Security for Oracle||Jul 28, 2016|
|SUSE LLC's SUSE Manager||Jul 21, 2016|
|My +1 Sword of Productivity||Jul 20, 2016|
|Non-Linux FOSS: Caffeine!||Jul 19, 2016|
|Murat Yener and Onur Dundar's Expert Android Studio (Wrox)||Jul 18, 2016|
- The Firebird Project's Firebird Relational Database
- Stunnel Security for Oracle
- My +1 Sword of Productivity
- Non-Linux FOSS: Caffeine!
- SUSE LLC's SUSE Manager
- Managing Linux Using Puppet
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Parsing an RSS News Feed with a Bash Script
- Google's SwiftShader Released
- Doing for User Space What We Did for Kernel Space
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