Screen Locking in Mac OS X

On Windows and Linux, it is simple to set up one’s workstation to have the screen locked when one steps away from the console.  On the Mac however, there is no explicit way to achieve that.  The following site has some good pointers: Quickly lock your screen

One of the best methods from the article is to “show the login window, without actually logging out. You can do this by
enabling fast user switching in the Accounts System Preferences panel.
Click the Login Options button (you’ll probably have to enter your
administrator password to do this), and then select the Enable Fast
User Switching option. Once you have fast user switching enabled,
you’ll see either an icon or a name in your menubar, depending on what
option you chose on the Login Options screen. Click on your name or
icon in the menubar and select Login Window from the drop-down menu.
The login window will appear. When you return to your Mac, login as you
usually do. All your applications will be just as your left them–even
your iTunes music will start up again where it stopped playing, even if
that means mid-song.”

Keyboard Remapping on Mac OS X 1.5

I’m trying to map my Mac iBooks keyboard to mimic the Happy Hacking keyboard (CapsLock = Control, Fn + Tab = CapsLock, and swap delete and ).  While this was trivial to accomplish on Windows Vista, I’m having a hard time on the Mac.  So far the closest reference I found is Keyboard Remapping in Mac OS X (10.4) but it doesn’t include a list of keys and the hex numbers that are associated with them.  Until I find that list, I’ll just be content with the CapsLock be mapped as Control, which cna be done in the System Preferences under Keyboard and Mice.

Grep Exclude

Ever wondered how to exclude a string from grep?  Last week I decided to dig until I find the answer, as I had to find a “lost” DB2 script in a pile of archives.  It turns out that grep has a feature called “grep for all except”.  Finally found that on a mailing list archive of COLUG.  Here is how it works:

grep pattern1 file | grep -v pattern2