How to fix Mac OS X Terminal Page Up/Down + Home/End of line

Updated for Mac OS X Mountain Lion 10.8.2.

In order to get page up and page down to work properly under Mac OSX Terminal, as well as the home and end of line (EoL), you need to go to Preferences and then Keyboard and configure the right escape key sequences.

(Note for laptop users: you don't have the page up/down and home/EoL keys, but you can simulate them by holding the "fn" key and pressing on an arrow key. So these configurations also apply to you.)

In the Terminal Preferences, go to the Keyboard pane and watch the the keys named 'page up', 'page down', 'home' and 'end'. You will see they already exist but are configured to scroll the buffer rather than sending commands to the server you're connected to.

In order to change this, double click on each of the relevant lines and select Action: "Send string to shell:"

You then need to enter the correct string to send to the shell. This is a multiple key sequence starting with the escape character (which is represented with it's octal code \033). Here are strings you can use for each key:

As of OSX 10.6.8, the correct fix is:

Key Recommended Escape Sequence Other possible sequences you can try if the recommended doesn't work for you
Home \033OH \033[1~ \033[H \001
End \033OF \033[4~ \033[F \005
Page Up \033[5~
Page Down \033[6~

You can either type these strings on your keyboard (start by presseing Esc) or you can just copy paste the strings from above.

It is worth noting that some of these are already bound to Shift-Page Up, Shift-Page Down, Shift-Home and Shift-End (which are obtained with Shift-Fn-Up/Down/Left/Right on a laptop keyboard). So if you can change your habits slightly you don't actually need to reconfigure anything.

Also note that some people (including Apple) recommend to use \033[H for Home but this doesn't actually work in vi or vim. This is why I recommend using \033OH which has worked in any shell or editor for me so far (Mac terminal, Debian terminal, vim, etc.)

If the recommended sequences don't work for you: please try the alternative suggested here. Also please let us know with which shell or editor you are trying to make them work and which escape sequences work best for you. This way we can order them in order of popularity and possibly give specific advice for specific environments to future visitors of this page. Thank you for your feedback.

How to use SSH private keys on Mac OS X

First cool thing that everybody knows already: Mac OSX is based on Unix so you get ssh out of the box.

Second cool thing you may not know: OS X 10.5 actually also comes with an ssh key agent (ssh-agent). That means that, without any additional software (like PuTTY Agent on Windows...), Mac OSX can actually load an encrypted private key into memory and remember it for all subsequent connections...

Third cool thing that almost seems too good to be true: ssh-agent can store the passwords of the encrypted keys into your keychain. Than means that you have to tell it once to remember the decryption password for your key(s) like this:

ssh-add -K .ssh/id_whatever_your_rivate_key_is

And next time you log into your mac and try to ssh somewhere, your private key will be loaded automagically (as long as your keychain is unlocked of course).

Very groovy!!

Making Time (is like Making Money)

Making Time (is like Making Money)

How many times have you heard “Time is Money”? It’s getting pretty old and boring, isn’t it?

Well here’s a new thought: Time is just like Money! Especially: you can’t just wait until you find it… if you want some, you have to make it! And in both cases: you have to develop skills to do that!

Think! ;)

The Dip: knowing when to quit and when to stick

I just finished reading "the dip" by Seth Godin. I actually didn't really know what the book was about and I basically picked it up just because it was less than $10 and because I loved previous books by Seth Godin (no doubt he's one of the greatest marketers of our generation!)

Well I'm glad I did. This is a small 76 page book, so it was pretty easy and fast to read! Actually, it could probably be even shorter and still make its point! But wow! More than making a point this book will actually pep you up and motivate you to hang in with your projects... or to quit before wasting any more time. Basically it tells you that the worst thing is to stay on a dead end track...

But for me, the most interesting part was the motivational part about how the dip before success is a normal thing to experience. If a project didn't have that painful phase where nothing seems easy and where you feel like you want to quit, then that project probably wouldn't be worth pursuing anyway... since just anyone else could do the same.

This is exactly the kind of stuff I want to read right now, with the down economy and everyone around loosing their energy.

Of course, the book also made me realize that a couple of my projects were sort of dead ends and that I should quit them right away. But that's part of the process! Reading this book over the last 2 days made me feel better about prioritizing my projects and cutting dead branches!

Minimum cash & time investment. High motivational return. Check it out! :)

The Dip: A Little Book That Teaches You When to Quit (and When to Stick) — Buy it now at Amazon.com

GTD, software and 43 Folders

GTD, software and 43 Folders

I have complained a couple of times that there was no decent GTD software available for Windows... to the point I'm actually considering switching to the Mac just for that!

People keep advising me to just fall back to the real life method of using 43 folders. For the record, that is: 12 folders for all the months in the year + 31 folders for all the days in a month. You then rotate the folders in a way that will make them pop up whatever you need on a specific day.

I so disagree with 43 folders being a replacement for GTD!

While the 43 folders are part of David Allen's GTD method, they do not replace software. GTD software presents you with a list of next actions you can do in a specific context and you can choose from them what you want to do without forgetting anything important. It has nothing to do with dates and deadlines.

The use of 43 folders on the contrary lets you easily pop up whatever needs to be acted upon on a specific date.

Granted some GTD software also copes with dates and deadlines but that is not the gist of GTD.

Now... I bet the confusion has a lot to do with Merlin Mann's site, named 43 Folders (which is a cool name indeed) and talking a lot about... GTD! :p