The Linux command line has a wealth of useful tools which exist because someone wanted to improve on the stock tools which come with most distros. As you expand your Linux Command Line Fu you’ll come across these tools which make life just a little more simple.

This post is focused on Ubuntu/Debian based distros for the reasons 1) I run Ubuntu on one Laptop 2) I run a Debian Shell on my Chromebook.

What I’m listing here are either replacements for stock bash commands or useful bash cli commands in their own right

Nala (apt replacement)

https://github.com/volitank/nala

Apt is the default package manager for almost every Debian distro and over the years has forked as apt-get, aptitude and a couple of other lesser used derivatives.

Apt is used to update, install and search for packages and as a tool is pretty well rounded.

Apt however can be a little confusing for new users so this is where Nala steps in

by not showing some redundant messages, formatting the packages better, and using color to show specifically what will happen with a package during install, removal, or an upgrade.

however as well as making the output look pretty what would a replacement be if there was no additional functionality built in to improve on the original?

Nala has 3 of these

Parallel Downloads

By default, Nala will download 3 packages per unique mirror in your sources.list file.

Opening multiple connections to the same mirror is great for speeding up downloading many small packages. Nala has the 3 connections per mirror limit to minimize how hard it is hitting mirrors.

Additionally Nala alternates downloads between the available mirrors to improve download speeds even further. If a mirror fails for whatever reason, Nala will just try the next until all defined mirrors are exhausted.

Fetch

nala fetch

This command works similar to how most people use netselect and netselect-aptnala fetch will check if your distro is either Debian or Ubuntu. Nala will then go get all the mirrors from the respective master list. Once done we test the latency and score each mirror. Nala will choose the fastest 3 mirrors (configurable) and write them to a file.

At the moment fetch will only work on Debian, Ubuntu and derivatives still tied to the main repos.

History

nala history

If you’re familiar with dnf this works much in the same way. Each Install, Remove or Upgrade we store in /var/lib/nala/history.json with a unique <ID> number.

At any time you can call nala history to print a summary of every transaction ever made. You can then further manipulate this with commands such as nala history undo <ID> or nala history redo <ID>.

If there is something in the history file that you don’t want you can use the nala history clear <ID> It will remove that entry. Alternatively, the clear command we accept –all will remove the entire history.

Installation

On the Chromebook Linux shell and Ubuntu 22.04 installation is as simple as

sudo apt install nala

There are further details on the command, installation and bug tracking on the link at the top of this section.

btop (top replacement)

https://github.com/aristocratos/btop

btop command

top is a tool that when run will provide information on what is running on the Linux/FreeBSD box (image below). CPU, Memory, processes etc all in a single command line type interface. Like apt above as an out-of-the-box tool it’s really useful and installed by default on most distros.

top command

There are plenty of alternatives to top out there, the most common one cited is htop which adds some colour and interaction.

Then there is btop, a tool which has been on a journey and this is its latest incarnation starting out as bashtop then being rewritten as bpytop in python and currently in its btop incarnation written in C++

As well as the well-laid-out interface the output screen is mouse-driven so you can use the up/down/left/right and enter buttons to navigate OR use your mouse.

The interface also has pretty handy options and a help menu built into it

Installation

On the Chromebook Linux shell and Ubuntu 22.04 installation is as simple as

sudo apt install btop

There are further details on the command, installation and bug tracking on the link at the top of this section.

fish (bash replacement)

https://github.com/fish-shell/fish-shell

The Friendly Interactive Shell (fish) is a smart and user-friendly command-line shell for macOS, Linux, and the rest of the family. fish includes features like syntax highlighting, autosuggest-as-you-type, and fancy tab completions that just work, with no configuration required.

Most Linux distros will come installed with a version of the Bourne Again Shell (bash) which offers a place for you the user to run Linux commands, create and run shell scripts and generally manage the OS.

There are however lots of alternatives ZSH for example springs to mind as a popular bash alternative.

The biggest driver as a shell for me with fish is its autocompletion, fish suggests commands as you type based on history and completions, just like a web browser.

It is also out of the box has a better colour scheme than most bash implementations.

Its well worth having a read of the tutorial for a better understanding of the differences between fish and other shells.

Installation

Fish is installable using

sudo apt install fish

The PPA however will ensure the latest version

sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
sudo apt install fish

Once installed, run fish from your current shell to try fish out!

neofetch

https://github.com/dylanaraps/neofetch

neofetch isn’t a replacement command it’s something you can use to find out information on your system and if you add the line fish to the end of ~/.bashrc every time you open a bash shell it will run and appear before the prompt.

Neofetch is a command-line system information tool written in bash 3.2+. Neofetch displays information about your operating system, software and hardware in an aesthetic and visually pleasing way.

The overall purpose of Neofetch is to be used in screen-shots of your system. Neofetch shows the information other people want to see. There are other tools available for proper system statistic/diagnostics.

neofetch git page.

If you’re so inclined you can through various flags create your own custom neofetch information with your own ASCII art photo.

Installation

On the Chromebook Linux shell and Ubuntu 22.04 installation is as simple as

sudo apt install neofetch

There are further details on the command, installation and bug tracking on the link at the top of this section.

lsd (ls replacement)

https://github.com/Peltoche/lsd

ls is one of the first commands a new Linux user learns in the shell and one of the first commands we learn switches for like ls -l and ls -lha.

While like many alternatives here the primary enhancement is colour, however as you can see from the screengrab above it also provides useful information in a well formatted way.

As well as the out-of-the-box improved look and feel its possible to customise a lot of how lsd works using a config file which is documented here https://github.com/Peltoche/lsd

Installation

Download the latest .deb package from the release page and install it via:

sudo dpkg -i lsd_0.20.1_amd64.deb # adapt version number and architecture

bat (cat replacement)

https://github.com/sharkdp/bat

Syntax highlighting example

Cat is another out-of-the-box useful command and most users’ first experience of it is for viewing files on the command line

The “cat” command in Bash stands for “concatenate”. This command is very frequently used for viewing, creating, and appending files in Linux.

bat enhances this with several key enhancements

Syntax highlighting

bat supports syntax highlighting for a large number of programming and markup languages:

Syntax highlighting example

Git integration

bat communicates with git to show modifications with respect to the index (see left side bar):

Git integration example

Show non-printable characters

You can use the -A/--show-all option to show and highlight non-printable characters:

Non-printable character example

Automatic paging

By default, bat pipes its own output to a pager (e.g. less) if the output is too large for one screen. If you would rather bat work like cat all the time (never page output), you can set --paging=never as an option, either on the command line or in your configuration file. If you intend to alias cat to bat in your shell configuration, you can use alias cat='bat --paging=never' to preserve the default behaviour.

File concatenation

Even with a pager set, you can still use bat to concatenate files. Whenever bat detects a non-interactive terminal (i.e. when you pipe into another process or into a file), bat will act as a drop-in replacement for cat and fall back to printing the plain file contents, regardless of the --pager option’s value.

Installation

On Ubuntu (using apt)

… and other Debian-based Linux distributions.

bat is available on Ubuntu since 20.04 (“Focal”) and Debian since August 2021 (Debian 11 – “Bullseye”).

If your Ubuntu/Debian installation is new enough you can simply run:

sudo apt install bat

Important: If you install bat this way, please note that the executable may be installed as batcat instead of bat (due to a name clash with another package). You can set up a bat -> batcat symlink or alias to prevent any issues that may come up because of this and to be consistent with other distributions:

mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat

On Ubuntu (using the most recent .deb packages)

… and other Debian-based Linux distributions.

If the package has not yet been promoted to your Ubuntu/Debian installation, or you want the most recent release of bat, download the latest .deb package from the release page and install it via:

sudo dpkg -i bat_0.18.3_amd64.deb  # adapt version number and architecture

procs (ps replacement)

https://github.com/dalance/procs

Linux is a multitasking and multi-user system. as such, it allows multiple processes to operate simultaneously without interfering with each other. Process is one of the important fundamental concepts of the Linux OS. A process is an executing instance of a program that carry out different tasks within the operating system. 

Linux provides us with a utility called ps for viewing information related to the processes on a system which stands as an abbreviation for “Process Status”. ps command is used to list the currently running processes and their PIDs along with some other information depending on different options. It reads the process information from the virtual files in /proc file system. /proc contains virtual files, this is the reason it’s referred as a virtual file system. 

To the beginner, the output of ps can be confusing and the switches to find information are equally baffling.

As with all the replacement commands on this page colour and a more human-readable format are highlighted as well as listed

  • Automatic theme detection based on terminal background
  • Multi-column keyword search
  • Some additional information which are not supported by ps
    • TCP/UDP port
    • Read/Write throughput
    • Docker container name
    • More memory information
  • Pager support
  • Watch mode (like top)
  • Tree view

You can change the configuration by writing a configuration file located in ~/.config/procs/config.toml

Installation

Download the latest .deb package from the release page and install it by unzipping the file and moving procs into the /usr/local/bin folder and using chmod to make it executable.

duf (df replacement)

https://github.com/muesli/duf

duf command

The df command is one most users will come across fairly early on in their Linux journey, its used to display the amount of free space available to a disk

df command

this is functional and will do in most cases, following the ongoing theme with all the replacement commands there are some enhancements made by duf

  • User-friendly, colourful output
  •  Adjusts to your terminal’s theme & width
  •  Sort the results according to your needs
  •  Groups & filters devices
  •  Can conveniently output JSON

Installation

On the Chromebook Linux shell and Ubuntu 22.04 installation is as simple as

sudo apt install duf
here are further details on the command, installation and bug tracking on the link at the top of this section.

is-up-cli

https://github.com/sindresorhus/is-up-cli

This is one of those simple command line tools that are oh so useful to have in your toolbox.

Written in npm this command will tell you if a website is up or down, simple as that

Installation

You’ll need to install node.js and NPM on Ubuntu or the ChromeOS Linux shell follow these instructions: https://linuxize.com/post/how-to-install-node-js-on-ubuntu-20-04/

Once done install using

npm install --global is-up-cli

aria2 (wget replacement)

https://aria2.github.io/

aria2 is a replacement for wget a tool for downloading files off websites, there is nothing sexy about wget it’s a long-standing functional bit of code which does a job.

What aria2 brings to the table is the following

  • Multi-Connection Download. aria2 can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth. Really speeds up your download experience.
  • Lightweight. aria2 doesn’t require much memory and CPU time. When disk cache is off, the physical memory usage is typically 4MiB (normal HTTP/FTP downloads) to 9MiB (BitTorrent downloads). CPU usage in BitTorrent with a download speed of 2.8MiB/sec is around 6%.
  • Fully Featured BitTorrent Client. All features you want in BitTorrent client are available: DHT, PEX, Encryption, Magnet URI, Web-Seeding, Selective Downloads, Local Peer Discovery and UDP tracker.
  • Metalink Enabled. aria2 supports The Metalink Download Description Format (aka Metalink v4), Metalink version 3 and Metalink/HTTP. Metalink offers the file verification, HTTP/FTP/SFTP/BitTorrent integration and the various configurations for language, location, OS, etc.
  • Remote Control. aria2 supports RPC interface to control the aria2 process. The supported interfaces are JSON-RPC (over HTTP and WebSocket) and XML-RPC.

So as well as looking prettier and providing some more useful output these features will also provide more options for downloading files.

Installation

On the Chromebook Linux shell and Ubuntu 22.04 installation is as simple as

sudo apt install aria2

here are further details on the command, installation and bug tracking on the link at the top of this section.

exa (ls replacement)

https://the.exa.website/

We covered lsd at the start of this post and there are no end of ls alternatives out there including exa

Standout features include

If these are features you’d look for in an ls replacement then exa is available almost everywhere.

Installation

On the Chromebook Linux shell and Ubuntu 22.04 installation is as simple as

sudo apt install exa
here are further details on the command, installation and bug tracking on the link at the top of this section.

glances (top replacement)

https://nicolargo.github.io/glances/

Like btop above glances is a replacement for the top command, and like btop, it provides extensive information on what’s running on your Linux box, with colour in a pretty layout. What sets glances apart however is the ability to also show this information in a web browser, so you could, install glances on servers but remotely check via a browser what’s going on on any machine.

Installation

Glances Auto Install script

To install the latest Glances production ready version, just enter the following command line:

curl -L https://bit.ly/glances | /bin/bash

or

wget -O- https://bit.ly/glances | /bin/bash

Note: Only supported on some GNU/Linux distributions.

dog (dig replacement)

https://github.com/ogham/dog

dig is a command which is used to look up the information on DNS Addresses, what IP’s do they point at, are web or mail addresses that type of thing. Its often found on Linux installed or installed with the bind-utils package.

dog is a command-line DNS client, like dig. It has colourful output, understands normal command-line argument syntax, supports the DNS-over-TLS and DNS-over-HTTPS protocols, and can emit JSON.

  • Understands sixteen record types: AAAAACAACNAMEHINFOLOCMXNAPTRNSOPTPTRSOASRVSSHFPTLSA, and TXT
  • Can use the UDP, TCP, DNS-over-TLS, and DNS-over-HTTPS network transports

Installation

Latest releases are found on the Github releases site https://github.com/ogham/dog/releases/

dust (du replacement)

https://github.com/bootandy/dust

While we can use the above df command to see the disk space available on our system the du (disk usage) command can be used to tell a user which directories are large and which files are taking up the space on the disk

While seeing this as a test with a standard du command is useful;

It’s far easier to understand this graphically

Dust is meant to give you an instant overview of which directories are using disk space without requiring sort or head. Dust will print a maximum of one ‘Did not have permissions message’.

Dust will list a slightly-less-than-the-terminal-height number of the biggest subdirectories or files and will smartly recurse down the tree to find the larger ones. There is no need for a ‘-d’ flag or a ‘-h’ flag. The largest subdirectories will be coloured.

The different colours on the bars: These represent the combined tree hierarchy & disk usage. The shades of grey are used to indicate which parent folder a subfolder belongs to. For instance, look at the above screenshot. .steam is a folder taking 44% of the space? From the .steam bar is a light grey line that goes up. All these folders are inside .steam so if you delete .steam all that stuff will be gone too.

Installation

Head over to the latest releases page Latest

Download the appropriate 64 to 32 bit deb file (probably 64 bit)

sudo dpkg -i <downloaded package name>

thefuck

https://github.com/nvbn/thefuck

While succinctly named this command is really useful for those of us who just cannot type

The command takes a previous command you typed wrong and tries to fix it.

➜ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

➜ fuck
sudo apt-get install vim [enter/↑/↓/ctrl+c]
[sudo] password for nvbn:
Reading package lists... Done

This is done by adhering to a ruleset

This is outlined really well here https://github.com/nvbn/thefuck#how-it-works

Installation

sudo apt update
sudo apt install python3-dev python3-pip python3-setuptools
pip3 install thefuck --user

gdebi

Throughout this post, you’ll have seen me use dpkg as the command line installer for deb packages which have been downloaded.

One of the issues you may have with dpkg is that the package tries to install but is missing dependencies needed to complete the installation and you will end up using a command like apt -f install to complete this

gdebi gets around this by figuring out what dependencies are missing and installing them as the same time of the deb file.

Installation

sudo apt install gdebi-core

nccm

https://github.com/flyingrhinonz/nccm

nccm is an SSH connection manager which is like Termius but from the command line.

There’s quite a lot to it and I’ll refer you to this post to see how to install and set up.

https://opensource.com/article/20/9/ssh-connection-manager

Once it is set up you’ll get a nice command-line interface for connecting to the remote ssh boxes.

Thoughts

It’s worth remembering that if you are learning Linux most of the howto guides you might follow will refer to the standard out-of-the-box commands like ls, dig, dpkg etc however while these commands are essential to running a Linux box there is no reason not to seek out some prettier potentially more useful commands to make life easier on the command line.

By davidfield

Tech Entusiast