1. 31
  1. 8

    Learning the existence and shortcuts of GNU Readline made me a better user of Bash and GDB.

    But the breakthrough was to learn about (and use) rlwrap (Readline wrapper), which adds Readline functionality to a software which doesn’t (originally) use it (e.g., telnet).

    With such a tool, it is possible to C-r, C-p, C-a, C-w, C-y, etc, in any command line interface.

    1. 2

      The day I found rlwrap to make the oracle SQL cli tool bearable was a good day

    2. 5

      This is an excellent submission. It’s clearly written, has some interesting configuration details, and includes some background on the developer.

      1. 3

        GNU Readline is also why CLISP is part of GNU. There was a (quite spirited) debate about how the GPL would work in practice, since the CLISP authors used GNU Readline but didn’t want to release CLISP under the GPL. In the end, RMS was able to convince them and the rest is (command-line) history.

        1. 3

          Great post but huge missed opportunity to title it “Things you thought you GNU about Readline”

          1. 3

            Oh, “horrible confusion”. I like to imagine that GNU pronounces their G in part because Knuth pronounces his K, but I’m probably just mythologizing.

          2. 2

            Like the author I struggled with users who were use to emacs mode and so they couldn’t switch to vi mode without losing their muscle memory. But, I discovered that the vi bindings in INSERT mode are largely a subset of those in emacs mode, so I created a readline config with a vi mode which has all of the emacs key bindings as well. This way folks can use emacs and vi keybindings. I also change the cursor to indicate which vi mode you are in.

            1. 1

              My favourite little-known readline command is operate-and-get-next:


              You can use it to search back in history with C-r and then execute that command with C-o and keep pressing C-o to execute the commands that followed that one in history. Very helpful for executing a whole block of history.

              For some reason, this documentation is hard to find! It’s not here, for example:


              The article linked above also seems to be unaware of it, as it recommends clobbering it.

              I’m a bit saddened when readline replacements don’t implement C-o. For example, the Python REPLs don’t have it.

                1. 1