Can home and end keys be mapped when using Terminal?
To answer the one about how to get the beginning or end of the line, it appears that by default Terminal maps these keys to it:


shift+home &rarr; beginning of line, equivalent to the "home" key in normal terminals
shift+end &rarr; end of line, equivalent to the "end" key in normal terminals


If you want home and end to work the "normal" way (and not require shift), go to [Terminal menu] &rarr; Preferences &rarr; Profiles tab (or settings on some versions of OS X) &rarr; Keyboard sub-tab.

Then modify/add these keys to be the following "send string to shell"


home: \033[H
end:  \033[F


You can get the \033 part by hitting the escape key within the edit dialog input, if you need to add it.

Then home and end will work like normal again (phew).

Also note that "alt + &larr;" and "alt + &rarr;" by default in terminal map to word left and word right, another handy combo to remember.

In later versions of Mac OS X, if the terminal screen shifts up or down when you press the home/end key, the home key may need to be set to \033[1~ and the end key to \033[4~ to get the results you want (no shift needed).

Feel free to modify this answer to add more useful key bindings, as it is a community wiki.