When I open terminal, I'd like the up arrow go to the last command I typed within nslookup. Instead, I get a strange escape sequence.

What must be done to allow me to up arrow in nslookup?

  • It is the default behaviour to get your last entered command when you press up arrow. You must've gotten something messed up.
    – Alex
    Commented Oct 25, 2012 at 19:05
  • @Alex You're right, but I seemed to just notice this within an interactive nslookup. I just revised the question. Commented Oct 25, 2012 at 19:12
  • The default "read an inputline from the user" under Unix does not support arrow keys. It is an extra library which needs to be used. Commented Oct 25, 2012 at 19:35

2 Answers 2


Nslookup on OS X does not seem to use readline, so it does not support the arrow keys.

You can install rlwrap, which is available in MacPorts and presumably other package managers. Then you can run

rlwrap nslookup

To get arrow key support.

Many thanks to this thread on the MacRumors forums.


If you are using bash someones changed your key bindings. Look at ~/.bash_profile and see what's in there. Alternatively go to the Preferences for Terminal and select the profile you are using and then click on the Keyboard Tab. See if the cursor up is set to anything weird there.

As someone else mentioned the default setting in Terminal and bash is to display the last command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .