A minimalist zero-dependency line editing library for terminal applications
A

A minimalist zero-dependency line editing library for terminal applications

A minimalist zero-dependency line editing library for terminal applications

CLI
4,307 stars
N/A forks
N/A contributors

README

Project documentation from GitHub

Linenoise: The Minimalist Line Editor for Your Terminal Apps

Ever found yourself building a CLI tool and wishing it had that polished, interactive feel? You know, with proper line editing, history navigation, and tab completion—just like your shell. But then you look at adding readline, and suddenly you're wrestling with a heavyweight, license-complicated dependency. It feels like overkill.

That's exactly the problem Linenoise solves. Created by antirez (of Redis fame), it's a self-contained, zero-dependency library that drops a capable line editor into your terminal application with almost no fuss. It's for developers who want to elevate their CLI tools from simple scanf-based input to something much more user-friendly, without the bloat.

What It Does

In a nutshell, Linenoise provides a small, embeddable alternative to GNU Readline and libedit. You integrate it into your C project, and it handles the user's line input for you. It offers familiar keyboard shortcuts for moving the cursor, editing the line, and scrolling through a persistent history. It also supports customizable tab completion. All of this happens in a single, portable .c and .h file pair.

Why It's Cool

The beauty of Linenoise is in its constraints. It's not trying to be everything for everyone. It's focused on doing the core job of line editing exceptionally well with minimal footprint.

  • Zero Dependencies: It only needs a standard C library and a POSIX-like terminal. You can literally just copy linenoise.c and linenoise.h into your project and you're 99% done. There's no complex build system to wrestle with.
  • Surprisingly Capable: Despite its size (under 1500 lines of C), it gives you the essentials: Emacs-style keybindings (Ctrl-A, Ctrl-E, Ctrl-K, etc.), history with up/down arrows, and basic but functional tab completion. It even handles multi-line editing and has optional UTF-8 support.
  • Battle-Tested: This isn't a toy. It was originally written for Redis, where it powers the redis-cli REPL. It's proven itself in a widely-used, production-grade tool.
  • The License is Painless: It's released under the BSD license, which is about as friendly as it gets for incorporating into any project, open source or commercial.

How to Try It

The quickest way to see it in action is to check out the repository and build the example. The whole process is refreshingly straightforward.

git clone https://github.com/antirez/linenoise.git
cd linenoise
make

This will build an example executable. You can run it to play with a simple shell that has history (try the up/down arrows)

Did you like this issue?

Join our weekly newsletter

Related Projects

Love discovering amazing projects?

Help us continue bringing you the best open-source discoveries every week.

Back to Projects
Last updated: Jan 23, 2026