A Quick Look at Elvish Shell

Everyone who comes to this site has some knowledge (no matter how slight) of the Bash shell that comes default of so many systems. There have been several attempts to create shells that solve some of the shortcomings of Bash that have appeared over the years. One such shell is Elvish, which we will look at today.

What is Elvish Shell?

Pipelines In Elvish
Pipelines In Elvish

Elvish is more than just a shell. It is also “an expressive programming language”. It has a number of interesting features including:

  • Written in Go
  • Built-in file manager, inspired by the Ranger file manager (Ctrl + N)
  • Searchable command history (Ctrl + R)
  • History of directories visited (Ctrl + L)
  • Powerful pipelines that support structured data, such as lists, maps, and functions
  • Includes a “standard set of control structures: conditional control with if, loops with for and while, and exception handling with try
  • Support for third-party modules via a package manager to extend Elvish
  • Licensed under the BSD 2-Clause license

“Why is it named Elvish?” I hear you shout. Well, according to their website, they chose their current name because:

In roguelikes, items made by the elves have a reputation of high quality. These are usually called elven items, but “elvish” was chosen because it ends with “sh”, a long tradition of Unix shells. It also rhymes with fish, one of the shells that influenced the philosophy of Elvish.

How to Install Elvish Shell

Elvish is available in several mainstream distributions.

Note that the software is very young. The most recent version is 0.12. According to the project’s GitHub page: “Despite its pre-1.0 status, it is already suitable for most daily interactive use.”

Elvish Control Structures
Elvish Control Structures

Debian and Ubuntu

Elvish packages were introduced into Debian Buster and Ubuntu 17.10. Unfortunately, those packages are out of date and you will need to use a PPA to install the latest version. You will need to use the following commands:

sudo add-apt-repository ppa:zhsj/elvish
sudo apt update
sudo apt install elvish

Fedora

Elvish is not available in the main Fedora repos. You will need to add the FZUG Repository to install Evlish. To do so, you will need to use these commands:

sudo dnf config-manager --add-repo=http://repo.fdzh.org/FZUG/FZUG.repol
sudo dnf install elvish

Arch

Elvish is available in the Arch User Repository.

I believe you know how to change shell in Linux so after installing you can switch to Elvish to use it.

Final Thoughts on Elvish Shell

Personally, I have no reason to install Elvish on any of my systems. I can get most of its features by installing a couple of small command line programs or using already installed programs.

For example, the search past commands feature already exists in Bash and it works pretty well. If you want to improve your ability to search past commands, I would recommend installing fzf instead. Fzf uses fuzzy search, so you don’t need to remember the exact command you are looking for. Fzf also allows you to preview and open files.

I do think that the fact that Elvish is also a programming language is neat, but I’ll stick with Bash shell scripting until Elvish matures a little more.

Have you every used Elvish? Do you think it would be worthwhile to install Elvish? What is your favorite Bash replacement? Please let us know in the comments below.

If you found this article interesting, please take a minute to share it on social media, Hacker News or Reddit.

Similar Posts

  • I can install it on windows 10 within BASH, but I got an error when running it:

    Cannot connect to daemon: unexpected RPC error on socket /tmp/elvish-1000/sock: dial unix /tmp/elvish-1000/sock: connect: connection refused
    Daemon-related functions will likely not work.
    Failed to initialize command history. Disabled.

    If I try to get command history, it panicks and aborts to bash.
    But if I run it with sudo, it’s ok.