05 01 | 2013

rlwrap: give readline super powers to any command line tool

Written by Tanguy

Classified in : Homepage, Debian, Command line

Did you ever use a tool such as netcat, which has no history and does not allow you to edit the line you are typing?

% nc localhost smtp
220 cocorico.example.com ESMTP Postfix
HELO localhost
250 cocorico.example.com
MAIL FROM: <tanguy@localhost>
250 2.1.0 Ok
RCTP TO: <tanguy@localhost>
502 5.5.2 Error: command not recognized
^[[A Sh*t, line recall does not work!
502 5.5.2 Error: command not recognized

Here comes rlwrap: it is a small and useful tool that wraps any command line-oriented tool using readline to provide you a history allow you to edit each line before you send it:

% rlwrap nc localhost smtp
220 cocorico.example.com ESMTP Postfix
HELO localhost
250 cocorico.example.com
MAIL FROM: <tanguy@localhost>
250 2.1.0 Ok
RCTP TO: <tanguy@localhost>
502 5.5.2 Error: command not recognized
 RCTP TO: <tanguy@localhost> ⇱…

rlwrap's effect is hard to describe with a transcript, so here are two screencasts, with and without it. If you often use tools such as netcat, try it!

SMTP session without rlwrap

SMTP session with rlwrap

3 comments

saturday 05 january 2013 à 21:23 tomás zerolo said : #1

Wow. Thanks. I did know about rlwrap (but never used it before). I've had the @#%&! experience with nc. But I hadn't made the combination in my little head!

monday 07 january 2013 à 05:25 Axel Beckert said : #2

There's also rlfe (readline frontend) which has the same purpose, but is distributed with readline itself and probably a little bit less powerful than rlwrap.

Previously there was also a tool named "cle" (something with "command line editor/environment/..."), but it has been removed from Debian a while ago already.

thursday 06 march 2014 à 14:04 Jim said : #3

thanks a lot

Write a comment

What is the first letter of the word ykkqw? : 

Archives