Ubuntu – How to have editing capabilities in command line apps that do not provide them

command lineediting

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?

Best Answer

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.