Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed MacPorts on OS X 10.5 and I found out that when I connect to the computer using SSH and use mc - Midnight Commander - the HOME and END keys do not work.

I have to mention that I'm using putty and I am able to use the keyboard very well on Linux machines like Fedora, Ubuntu,...

Here is putty keyboard configuration (a configuration I found to be optimal over time):

  • Backspace key: 127
  • Home/End keys: Standard
  • Function keys: Xterm R6
  • Cursor keys: Normal
  • Numpad: normal
  • Terminal type string: xterm-color

I'm looking for a command line solution/script that does these changes, this make much easier to create a prepare OS script for configuring a new OS.

share|improve this question
add comment

4 Answers

up vote 11 down vote accepted

The keyboard mappings for home and end in Terminal.app are not direct, but you can fix them. To get them to work directly, go to Terminal -> Preferences... -> Settings screen -> Keyboard and then find the lines for these keys and click the edit button for them (or add them if they are missing for some reason).

Be careful to not have any leading or trailing spaces as well for these.

home key code:

\033[H

end key code:

\033[F

page-up key code:

\033[5~

page-down key code:

\033[6~

Screenshot1

Screenshot2

share|improve this answer
    
I wasn't able to enter the sequences because backslash is auto-translated to double-backslash (OS X 10.6). Also, I would prefer a script/command line for doing these settings (if possible). –  sorin Mar 9 '10 at 6:52
    
@Sorin Strange, I am running OS 10.6 and that's the OS I did my screenshots with, but then again I made my profile on 10.5. It appears that typing in the control sequence into TextEdit and then doing a copy and paste into the field works fine. –  Lara Dougan Mar 11 '10 at 7:10
    
Legend, thanks! PageUp and PageDown now work properly in vim :-) –  Sonia Hamilton Dec 17 '13 at 4:17
    
\033 is entered by pressing the escape key –  Wadsworth Jun 26 at 7:52
add comment

Hold down the shift key for Home/End PgUp/Pg down in Terminal.app in order to not let Terminal use these keys for the scrollback. This way (with shift) Terminal will pass the keys on to the application running in the window.

share|improve this answer
add comment

The actual question was how to use Home and End keys with PuTTY when logged into OSX using ssh.

First, I changed the settings in the OSX Terminal.app preferences according to this link. It worked for me to fix Home and End keys for usage on desktop. However when logged into OSX remotely with PuTTY, Home and End keys still didn't work. So I modified PuTTY terminal as below:

Go to PuTTY configuration > Terminal > Keyboard
find "The function keys and keypad"
instead of
ESC[n~
choose
SCO
click Apply.

Your Home and End keys should work properly now on your PuTTY terminal when you are logged into OSX.

You can set and save different settings for your different sessions. When you login to other type machines you may use standard PuTTY setting.

share|improve this answer
add comment

I had a similar problem after switching to the Mac. In OS X, Home and End take you to the start and finish of a document respectively. Think of them as Page Up and Page Down on steroids.

To do the equivalent to the Windows usage of Home and End, use Command+Left Arrow and Command+Right Arrow.

share|improve this answer
    
Sorry but this a different problem and is not related to the one specified to you. –  sorin Jul 31 '09 at 12:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.