Line editing in dash

In or it is possible to move around the typed line word by word, using shortcuts such as ESCB.

That doesn’t work in or . As far as I understand from googling, this has something to do with readline support, however nowhere I’ve seen it mention how to enable support for dash.

That’s the core of my question: How to enable line navigation for dash

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

If you definitely want dash plus command-line editing and history, you can use rlwrap:

rlwrap dash


rlwrap -cmD2 dash

To use rlwrap, you’ll have to:

sudo apt-get install rlwrap

Solution 2

The short answer is:

You don’t.

dash is a direct descendent of the Almquist Shell (ash). ash never featured line editing support, and neither does dash. Busybox ash does, so if you must an ash variant for some reason and have line editing, etc., use Busybox ash. Nobody’s going to bother with adding readline support, since dash‘s primary use is for running shell scripts.

Unless, of course, you’re willing to code support for readline in dash, and maintain such a patch yourself…

The long answer is:

Compile with libedit

If you look at dash‘s manpage:

-V vi           Enable the built-in vi(1) command line editor
                (disables -E if it has been set).

-E emacs        Enable the built-in emacs(1) command line editor
                (disables -V if it has been set).

These only work if dash was compiled with --with-libedit. It isn’t, neither in Ubuntu, nor, apparently, in Debian.

You can build it thus:

git clone
cd dash 
./configure --with-libedit 

Then run:

src/dash -E

You should be able to use the arrow keys to edit the current command.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply