Search

rlwrap: use readline’s line editing with all applications

January 17th, 2007 edited by lucas

Entry submitted by arno. DPOTD needs your help, please contribute !

Many command-line-oriented applications don’t provide features like history, completion or line-editing. rlwrap wraps readline (which is the library behind those features in bash and many other applications) around any line-oriented command. So you can take advantage of history, completion and editing facilities, even with applications that don’t provide them. rlwrap is the kind of tool that, once discovered, makes you wonder how you could have lived without it.

For example, telnet or netcat don’t have editing facilities, neither history. With rlwrap, system administrators will then be able to use those tools more efficiently. Also, launching dash can sometimes help testing compatibility for a few lines of shell code. Unfortunately, line editing with dash is not very pleasant. With rlwrap, it becomes possible to have completion and history in dash.

By default, history is saved in a specific file for each program: your history will be kept even after exiting the program, and will not conflict with other apps.

Just as readline, you can customize rlwrap with ~/.inputrc file. You can also define, for each application, a list of keywords. rlwrap will then perform completion on those words.

With socat, you can also wrap readline around any program. Socat is much more than a readline wrapper: using it only for that purpose would be not only overkill, but also more complex. Another readline wrapper is cle (Command Line Editor). It’s a great tool, but it has not been developed since 1999. Rlwrap is now more powerful, providing more options, with more configuration capabilities.

Target Usages:

Users of applications such as netcat, telnet, dc, that don’t link with readline, and whose editing possibilities are limited.

Tip:

If your shell supports it, you may find useful to define aliases for commands you often use ; for example: alias netcat="rlwrap netcat".

You can find rlwrap’s homepage at http://utopia.knoware.nl/~hlub/uck/rlwrap/

rlwrap is available in Debian (0.21-1 in sarge, 0.28-2 in unstable) and Ubuntu (0.24-1 in dapper and edgy).

Posted in Debian, Ubuntu |

6 Responses

  1. EvilDead Says:

    Very interesting! Gnuplot works better as I may now use home, end… :-)

  2. coNP Says:

    Thanks a lot. Really a very useful tool.

  3. Yannick Says:

    Very very useful !!!
    As you said.. how could I have lived without it ?? :))
    Thank you very much

  4. bzhou Says:

    A similar package is rlfe.

  5. Bob Says:

    Very useful tool. If you have started telnet session using rlwrap then is there any way to send escape char to tenet process (so that telnet goes into command mode) ? when I press escape char on telnet session (using rlwrap) it doesn’t go to command mode.

  6. William Mayo Says:

    Oh my god thank you. Mit and MZ scheme’s REPLs just got usable.