Cheat sheets for the shell
Interactive Cheat Sheet
When the history function fails and the manpage is too long, navi comes to the rescue with an interactive cheat sheet for the shell.
What exactly was that parameter for creating an archive with tar
? Command-line aficionados know that if nothing shows up with the Bash history
command, your only option is to look at the manpage. While manpages are generally useful, some are so extensive that the time spent searching for information is disproportionate to the task at hand. An alternative to this problem is an interactive cheat sheet.
While there are plenty of cheat sheet tools on GitHub, the relatively young navi [1] offers both good functionality and an eye-pleasing design. Navi helps users browse built-in (DIY or downloaded) cheat sheets to display options and arguments for commands or directly execute the commands. Navi (as well as similar tools) lets you interactively learn about newly discovered commands and explore all their possibilities.
Installation
You can quickly install navi from the website (Listing 1). In addition, you can optionally install navi in an arbitrary directory (line 6) instead of in your path.
Listing 1
Installing navi
01 $ sudo git clone --depth 1 https://github.com/denisidoro/navi /opt/navi 02 $ cd /opt/navi 03 ### Install in $PATH 04 $ sudo make install 05 ### Alternatively 06 $ ./scripts/install <directory>
Navi does have a couple of dependencies. To avoid having navi complain, you must install the fzf string matching algorithm, a search tool that uses fuzzy searches to quickly find specific strings in a longer string or text.
You can find fzf in the Debian, Fedora, and Arch Linux repositories, where you can install it with the standard package manager. Alternatively, Mac OS X users can use Homebrew [2] for the installation. For Z shell [3] users, navi's developer offers a guide for integrating the widely used Oh My ZSH [4] configuration file.
Navi's only other dependency is ncurses, which should be preinstalled on every distribution.
Since work on the relatively young navi is ongoing, you will want to update the software regularly. When a new version appears on GitHub, you can update navi quickly with git
(Listing 2).
Listing 2
Updating navi
$ cd "$(navi home)" $ sudo git pull
Getting Started
First, you will want to briefly familiarize yourself with navi's arguments and options by calling navi --help
in a shell. Then start the program by entering navi
. Navi opens a current list of 242 embedded cheat sheets (Figure 1).
In the three-part view in Figure 1, you can see the application or environment from which the commands originate on the left, the tasks to be performed with them in the middle, and the corresponding command on the right. You can choose to limit the display of commands to one category. For example,
navi query git
only shows commands for git
. Alternatively, you can narrow down the results in the window by typing ip addr
, which results in the three commands that deal with IP addresses (Figure 2).
Direct Execution
Navi's interactivity comes into play when you double-click on a selected command. If the command requires no further input, the program passes it directly to the shell. For instance, clicking on the List running services task from the systemctl, service category takes you directly to a list of running services (Figure 3). In this example, direct execution of the command does not pose a problem, because the command only prints a list and makes no other changes to your system.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.