Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There are some command line programs that take input from the user, but do not provide editing capabilities, like sh (alias dash), or nslookup and others.

There is a way to force such applications to provide editing capabilities to correct the current line or recall previous lines?

share|improve this question
up vote 2 down vote accepted

There are at least three tool to obtain what is required, these are:

  • rlwrap -- readline feature command line wrapper
  • rlfe -- a front-end using readline to "cook" input lines for other programs
  • ledit -- line editor for interactive programs

You can use each of them simpy prepeding to command to wrap, as in

rlwrap sh

The first, rlwrap, seems the best, because the second make the line in bold, and the third fails to show the prompt with sh, nevertheless it works.

share|improve this answer

The ubiquitous technology to learn is readline, because programs that have been compiled with readline support already have this capability - in whatever Linux distribution and in whatever Unix GNU utilities. (Most GNU programs have been done this way, and it's "painful" when they have not - enough for me that I would recompile them if they didn't get done "right.") It's a lot like learning the vi editor - once it's "in you" it never leaves; and, it makes working with the various programs much more proficient and enjoyable. The readline support behaves the same in whichever program was compiled with that library. How readline was implemented in an individual software program was up to the programmer(s) of that program, so mileage may vary.

For example, in BASH, the up arrow key recalls the previous line, and in almost any console program, [CTRL]+[U] erases everything left of the cursor while [ALT]+[F] moves forward one word and [ALT]+[B] moves backward one word, and many more...

Nslookup does have this, and sh/dash - but they are minimal.

share|improve this answer

Your Answer


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.