rlwrap: use readline’s line editing with all applications
January 17th, 2007 edited by lucasEntry 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).
January 17th, 2007 at 7:08 am
Very interesting! Gnuplot works better as I may now use home, end… :-)
January 17th, 2007 at 9:40 am
Thanks a lot. Really a very useful tool.
January 17th, 2007 at 7:55 pm
Very very useful !!!
As you said.. how could I have lived without it ?? :))
Thank you very much
January 17th, 2007 at 10:01 pm
A similar package is rlfe.
September 19th, 2008 at 12:40 pm
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.
October 17th, 2008 at 5:07 pm
Oh my god thank you. Mit and MZ scheme’s REPLs just got usable.