CategoryComputingTips > LinuxCompTips

Random Linux Tips

ps

ps aux|grep ap\\ache

will show just the apache processes and not grep itself because:

  1. Your shell removes one \ and passes grep ap\ache
  2. ps lists the grep as grep ap\ache
  3. grep reads \a as a since a isn't special and looks for "apache" but doesn't pick up the line that has "grep ap\ache" in it since that doesn't match.


Paul Sladen adds that he finds it easier to do:

    ps aux | grep [a]pache

This works because it matches an "a" followed by "pache" but which doesn't match the string "[a]pache"

info pages

Given the tendancy to provide crap manpages and better info pages, you might want to try pinfo instead of just the plain info program to view them. pinfo can view manpages as well and has lynx like keys. It highlights links to other manpages/info pages and is a lot easier to use than info.


uz/lz

uz and lz are really useful for allowing you to get on with your life and just view archives while they remember how to do it for bzipped archives, gzipped archives, rpms, debs, arc, arj, rar, lha and more (providing you have the relevant utilities installed).

See http://hjbaader.de/download/lz_e.html to get them.


Compose key

It's easy to type accents with a UK keyboard and one of the best ways is to have a compose key setup in your keymap. This works both on the console and in X.

If you don't use the windows keys you can use:

keycode 126 = Compose

in your keymap.

Once you load a keymap with that (or even just echo "keycode 126 = Compose"|loadkeys to add it temporarily) then your right windows key will be remapped as a Compose key. It's a dead key so you hit it, then release it, then hit two more keys to obtain a character. Try hitting Compose then ' then e for instance - you should see an e acute.

If you want to see what the key codes are the easiest way is to run showkey from the console.


Compose key - Part Deux

An alternative way to create a compose key is to do it just in X with xmodmap. You can use for instance the Windows menu key. xmodmap -e "keysym Menu = Multi_key" should map that as the Multi_key which is X's name for the compose key.

If you run xev and then hit keys you'll see their keycodes and keysyms.

If you see something like:

xmodmap:  commandline:0:  bad keysym target keysym 'Menu', no corresponding keycodes

Then you should run xev and find out what the keycode is and then do something like xmodmap -e "keycode 115 = Multi_key" for instance if the keycode you find is 115. Note that that says keycode, not keysym, this time; otherwise you end up with strange keyboard brokenness, which is quite hard to fix because you've just broken your keyboard :-)

If you map it as in the previous section (in the keymap) then it will work everywhere though and not just in X.


Accents in bash (well readline)

For 8bit characters to show up you need to have a .inputrc which has at least this:

set convert-meta off
set input-meta on
set meta-flag on
set output-meta on

Accents in mutt

You will need in your muttrc:

set charset="iso-8859-15"

or whatever your terminal can display.

You'll also need a character set type in your locale that is capable of displaying these characters:

export LC_CTYPE=en_GB.ISO8859-1

for instance.

TheEarthWiki: LinuxCompTips (last edited 2008-02-19 15:39:26 by localhost)