13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 9 ■ WORKING WITH TEXT IN FILESIn GTK+ 2 (so this should work in Gnome Terminal, Mozilla, Firefox, and possibly otherapplications), you can enter a UTF-8 character using its hex code. Hold down Ctrl and Shift, and enterthe four-digit code. So, holding Ctrl-Shift while entering 0123 will give you a Latin g with a cedilla overit (ģ).This is a bit of a nuisance for any characters you enter regularly, however. For these, you’re better offextending your keyboard mapping with xmodmap. (Warning: this can be complicated!)The first step is to find out what your current mapping is. The command xmodmap -pm will give yououtput that looks a bit like this:xmodmap: up to 2 keys per modifier, (keycodes in parentheses):shiftlockcontrolmod1mod2mod3mod4mod5Shift_L (0x40), Shift_R (0x44)Caps_Lock (0x41)Control_L (0x43), Control_R (0x46)Mode_switch (0x42), Mode_switch (0x45)Meta_L (0x3f), Meta_R (0x47)This tells you what modifiers are currently in use. Shift is defined as either the L or R shift keys,similarly for Ctrl and meta (Alt). Caps Lock is obvious. Mode_switch is usually the Alt-Gr key; if you’reusing a Windows keyboard, this may be mapped to the two Windows keys (between Ctrl and Alt). Youcan check by running xev and hitting the relevant key. The keycode will be given.■ Note xmodmap gives the keycode in hex in this section but later in decimal; xev uses decimal. To convert,use bc:ibase=10obase=166642ibase=16obase=104266ibase sets the input base, and obase sets the output base. So, the first three lines set the input in decimal, set theoutput in hex, and ask for the value of 66 (decimal) in hex (which is 42). The next lines set input in hex, output indecimal, and ask for 42 (hex) in decimal (which of course is 66!).197Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!