linenoise
A small self-contained alternative to readline and libedit
Automatically checked · GitHub checked 2026-11-17

Overview
A minimal, zero-config, BSD licensed, readline replacement used in Redis, MongoDB, Android and many other projects. - Single and multi line editing mode with the usual key bindings implemented. - History handling. - Completion. - Hints (suggestions at the right of the prompt as you type). - Multiplexing mode, with prompt hiding/restoring for asynchronous output. - Bracketed paste support, with large or multi line pastes folded on screen. - UTF-8 support for multi-byte characters and emoji. - About ~1600 lines (comments and spaces excluded) of BSD license source code. - Only uses a subset of VT100 escapes (ANSI.SYS compatible). Line editing with some support for history is a really important feature for command line utilities. Instead of retyping almost the same stuff again and again it's just much better to hit the up arrow and edit on syntax errors, or in order to try a slightly different command. But apparently code dealing with terminals is some sort of Black Magic: readline is 30k lines of code, libedit 20k. Is it reasonable to link small utilities to huge libraries just to get a minimal support for line editing? Large programs with configure scripts disabling line editing if readline is not present in the system, or not supporting it at all since readline is GPL licensed and libedit (the BSD clone) is not as known and available as readline is (real world example of this problem: Tclsh). Smaller programs not using a configure script not supporting line editing at all (A problem we had with redis-cli, for instance). The result is a pollution of binaries without line editing support. Apparently almost every terminal you can happen to use today has some kind of support for basic VT100 escape sequences. So I tried to write a lib using just very basic VT100 features. The resulting library appears to work everywhere I tried to use it, and now can work even on ANSI.SYS compatible terminals, since no VT220 specific sequences are used anymore. Linenoise is BSD-licensed code, so you can use both in free software and commercial software.