| « How to get AC-3 5.1 surround sound on your Mac | Secure SSH private keys on Mac OSX 10.5 » |
Mac OSX Terminal Page Up/Down + Home/End of line
12/21/08
Mac OSX Terminal Page Up/Down + Home/End of line
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, you need to go to Preferences and then Keyboard and configure the right escape key sequences:
| Key | Escape Sequence |
|---|---|
| Home | \033[1~ |
| End | \033[4~ |
| Page Up | \033[5~ |
| Page Down | \033[6~ |
14 comments
01/07/09 @ 22:28
Comment from: Jorge Lobo [Visitor]
I use space to page down, the mac two key page up and down scrolls the window, not the terminal text
03/16/09 @ 22:57
Comment from: Brian [Visitor]
04/18/09 @ 17:55
Comment from: theman [Visitor]
CTRL-A -- this is to go to the beginning of a line in Bash (set this to the 'Home' key)
CTRL-E -- this is to go to the end of the line in Bash (set this to the 'End' key)
The first combo will produce: \005
The second combo will produce: \001
Don't worry, it works in 10.5.x. This also works in the C Shell ('csh'), so if you are used to using it this will work there as well.
05/12/09 @ 04:26
Comment from: Richard P. Spillane [Visitor]
Terminal->Preferences->[Settings]->[Keyboard]:
Find end, home, pg up, and pg down (the list is alphabetically sorted).
First double click 'end' and a prompt comes up that lets you remap the key, for 'Action' select 'send string to shell:' and then click on the entry field.
Press 'Esc' which emits '\033' then type '[4~' after it, so the text field should now show: "\033[4~". Click 'OK'.
Now you should be able to remap the other keys if you know the key codes, by pressing 'Esc' to emit \033. The codes for each of the keys are:
end \033[4~
home \033[1~
page down \033[6~
page up \033[5~
You will want to add 'Shift-pgdwn/pgup' to ask the buffer to scroll up and down. Do this by clicking '+' and adding 'pg down' with the 'Shift' modifier and then select 'scroll to next page in buffer', and do the opposite for pg up.
I believe this is the optimal fix.
07/24/09 @ 07:46
Comment from: Jaap Blom [Visitor]
08/27/09 @ 15:29
Cheers!
09/24/09 @ 00:24
Comment from: Alex [Visitor]
Would love to get this working if anyone knows off the top of their head what I'm doing wrong.
11/06/09 @ 17:54
Comment from: Warren Houghteling [Visitor]
12/08/09 @ 19:47
Comment from: norman [Visitor]
Key Escape Sequence
Home \033OH
End \033OF
The O's are captital as in OOPs, they are not zero's. This is straight from termcap for xterm and works for both the bash shell and vi/vim
01/27/10 @ 14:48
This post has 5 feedbacks awaiting moderation...
