Ultimate List of Unusual but Really Useful Linux Shell Commands

The Ultimate List of Linux Commands Title Image

This is a compilation of lesser known Linux shell commands – but really useful ones. Useful as in: saving time, giving you additional tools to do things you couldn’t before, but also entertaining. Enjoy reading, and let us know in the comments if there are additional tools we should add!

Installation instructions will be for Debian based systems, they have been tested on Raspberry Pi OS, on a Raspberry Pi 4 / 1 GB. YMMV on other systems, but simply have a go and try these commands 🙂

sudo !!

This will execute the previous command with prepended sudo. Really useful if you forgot to prepend a command with sudo:

apt-get update
sudo !!

No need to install it, if sudo is on your system, this should work. Note the space between sudo and the exclamation marks.

The sudo-prepended command will also be added to your bash history, so you can conveniently access it by typing the “up” arrow key to repeat it. (I’ve demonstrated this in the animation above. sudo !! itself will NOT be added to your history)

tac (cat backwards)

This handy instruction is built-in along with it’s better known brother, cat. Pass a file to it, to have it reverse the line order in the file, printing the last line first:

tac /etc/magic

This command should come in really handy if you’re looking at log files, for example.

tldr – manpages, simplified!

manpages are useful, but sometimes quite lengthy. Have you found yourself Googling instead of looking at the manpage? Simply because you want real-life examples for every day use, instead of all the bells and whistles a command has to offer? tldr delivers “collaborative cheatsheets for console commands”

TL;DR: tldr is the tool to get for quick summaries of Linux commands

There is also a PDF version (tldr.sh) which includes all the currently available tldr pages

installation of tldr

note: This will require npm / node.js to be installed on your Linux system.

npm install -g tldr

using tldr

simply type tldr followed by the command you’re interested in. On the first run, tldr will update it’s cache and create an index, which will take a little while. For example. to see the tldr page on gzip, run:

tldr gzip

contributing and tldr alternatives

If you would like to contribute to tldr, have a look at the GitHub – tldr-pages/tldr: 📚 Collaborative cheatsheets for console commands, and their contributing guidelines.

There are some alternatives:

  • Cheat
  • Bro Pages (“just get to the point”)
  • navi – allows you to browse through cheatsheets in an interactive fashion & build the command you’d like to execute
  • cheat.sh – can be used without installing anything, by using curl

how2 – stackoverflow from the terminal

tldr and cousins are really useful if you already know the command you are going after. But what can you do if you only know what you need to do, but not yet, how? We all know how distracting browsers can get. The tool how2 helps you to get a quick answer without ever leaving the command line.

how2 installation

Requires node.js and npm package manager to be installed on your system.

sudo npm install -g how-2

how2 usage

how2 mount an NTFS drive in Raspbian

If you’re satisfied with the answer, press the Enter key to exit how2 – otherwise press space to get more choices. Use the arrow keys on your keyboard to navigate, and Esc to exit.

howdoi – get answers to coding questions from the command line

In a similar vein, if you’re looking for answers to coding questions on the command line, without having to switch to a browser, check out howdoi:

howdoi installation

sudo apt-get update
sudo apt-get install libxml2-dev libxslt-dev python3-lxml python-lxml python-dev
sudo pip3 install howdoi

using howdoi

howdoi howdoi
howdoi use tensorflow in python
howdoi -c shut down the system with Python

The -c flag will enable colorized output. By default howdoi will search using Google, but you can also choose to use bing or duckduckgo.

autojump – a faster way to navigate your filesystem

autojump maintains a database of the directories you visit most from the command line, and allows you to jump to the directory by giving only part of it’s name. No need to repeatedly cd into your target directory anymore!

autojump installation

sudo apt-get update
sudo apt-get install autojump

For policy reasons, you will then need to add autojump manually to your ~/.bashrc for non-login interactive shells, and to your ~/.bash_profile for login shells:

nano ~/.bashrc

and add the following line at the bottom:

. /usr/share/autojump/autojump.sh

Note: you’ll need to reopen the Terminal / reconnect via SSH for this to be applied.

using autojump

autojump comes with a convenient shortcut, “j”, which helps you to type less. To get started with autojump, you will need to pre-seed the directory paths. Navigate normally, e.g.

cd /etc/python

After building this cache of directories you visit (autojump will keep track of the frequency!), you will be able to jump to them by typing part of the name, e.g.:

j pyt

Similar tools to autojump

There are a couple of similar applications to autojump:

mtr – a combination of ping and traceroute

mtr will show you the path your network packets take to a host from your Raspberry Pi. This is useful for network diagnostics, to analyze latency for example. But it’s also simply interesting to see how the Internet works, passing along your packets from one host to another 🙂

installation of mtr

sudo apt-get update
sudo apt-get install mtr

Usage of mtr


mtr will send packets with purposely low TTLs (time to live), continuing to increase them, to analyze the network paths. A sudden increase in packet loss or response time is often an indication of a bad (or simply overloaded) link.

bat: cat code files with syntax highlighting

There are many cat clones: bat is a cat clone with wings. It has a couple of additional features beneath it’s wings, to make it a powerful replacement for cat:

  • syntax highlighting for many programming and markup languages
  • integration with git to show modifications
  • optionally show non-printable characters (using the -A flag)

By default, bat will also pipe it’s own output to a pager (e.g. less) if the output is too large for one screen.

bat installation

The bat GitHub page gives installation instructions for different Linux systems (and even Windows!)

bat is currently only available in the “sid” (unstable) version of Debian. To install it on Raspberry Pi OS, head on over to https://github.com/sharkdp/bat/releases, and download the appropriate package. (if you’re running a 32 bit Raspberry Pi OS, use the bat_*.armhf.deb, for 64 bit use bat_*_arm64.deb; if you’re setting this up on an x86 / AMD64 system, these packages are available, too).

cd /tmp
wget https://github.com/sharkdp/bat/releases/download/v0.17.1/bat_0.17.1_armhf.deb
sudo apt-get install ./bat_0.17.1_armhf.deb

bat usage

Simply use bat like you would use cat:

bat example.py

Syntax highlighting will be determined from the first line of a file (ideally a shebang such as #!/bin/sh)

asciinema & svg-term-cli: create SVG movies from shell interactions

Note: this is asciinema, not asciicinema 🙂

You could use OBS Studio to capture your screen and create a movie for YouTube, showing off the shell. But – it’s a video, which has some disadvantages:

  • size
  • resolution is fixed

asciinema allows you to capture these as text streams, and publish them as a so-called asciicast. You can embed them in your pages by including a little JavaScript snippet which they provide. Check out an example of the asciicast we’ve recorded for this blog post.

When used with svg-term-cli, it allows you to create SVG animations! These movies are vector animations, perfectly suited for interactions in the shell. They are smaller than video files, and can be zoomed without loss of quality. Additionally, no JavaScript will be required. When including lots of these asciicasts, however, I recommend to go with the JavaScript options – otherwise the performance of the page will suffer.

Installation of asciinema

Here is a link to installation instructions for asciinema, we’ll have a look at those for Raspberry Pi OS (Debian):

sudo apt-get update
sudo apt-get install asciinema

Additionally, you should set up an account on asciinema.org – you just need your e-Mail address, and link your account with the asciinema install on your Raspberry Pi, by running:

asciinema auth

This will generate an URL for you – by visiting the URL, while you’re logged in, you will link the local asciinema installation to your asciinema.org account. This will allow you to manage the recordings (set titles, edit descriptions, set them public), and avoid having the recordings automatically archived after 7 days.

Installation of svg-term-cli

Note: this requires node.js & the packaging manager npm to work. This is only necessary if you want to create animated .SVG files from your asciicasts.

sudo npm install -g svg-term-cli

Usage of asciinema

To start recording, type:

asciinema rec

This will spawn a new shell instance, and start to record terminal interactions. To finish recording, hit Ctrl + D or type exit

asciinema will now ask you whether you want to upload your recording to asciinema.org (by pressing Enter), or to save it locally (by pressing Ctrl + C). In the latter case, a .cast file will be created in the temporary directory:

asciinema: recording finished
asciinema: press to upload to asciinema.org, to save locally
asciinema: asciicast saved to /tmp/tmp21kux252-ascii.cast

You can also specify the output file to use:

asciinema rec /tmp/example.cast

Tip: scale your terminal window to the column and row resolution you would like to have in the animation before starting the recording; svg-term-cli’s options –width and –height will simply crop the output

To upload the file to asciinema, you can now run:

asciinema upload /tmp/example.cast

See this page for more elaborate instructions on asciinema usage.

Convert asciinema .cast file to .svg file using svg-term-cli

One option (and the recommended one for performance reasons) is to host your .cast files on asciinema.org – which is well-documented on their page. Here we’ll explore the option to convert the recording to an animated .svg file.

svg-term --in /tmp/tmp21kux252-ascii.cast --out /tmp/example.svg

Note: WordPress disables SVG upload by default for security reasons. There are plugins to allow SVG uploads in a safe fashion.

exa: a modern replacement for ls

While ls can be made to display colors, exa uses colors in a really optimized way, and supports you with additional information.

For example, a tree view is built in – showing you your files’ information alongside the hierarchy. exa also knows about different file types, and will show them in different colors. Furthermore, it has built-in Git support to view the staged / unstaged status in the standard view.

installing exa

sudo apt-get update
sudo apt-get install exa

using exa


exa works similar to ls. use the flags -l to display a list with details about your files and directories, -T to display a tree view including subdirectories, and -Tl to display a combined tree / detail view. Refer to the exa documentation for more information.

shuf: randomize lines in a file

Let’s say that you want to create a random list (of users, activities, take your pick!) by shuffling entries in a file. Well, you’re in luck with this tool (which should already be preinstalled):

shuf example.txt

rig: create fake identities

Sometimes a page forces you to sign up with your identity. These pages are clever: they check that your city matches your ZIP code, for example. rig allows you to manage this challenge by supplying you with unlimited fake identities on demand (US), which should be somewhat correct geographically. rig in itself is based on the appropriately named “fake” MSDOS application.

Installation of rig

sudo apt-get update
sudo apt-get install rig

Usage of rig


browsh – a modern text-based browser

We all know about lynx, which allows you to open any web page (for example Wikipedia) from the command line. lynx, as of 2020 is the oldest web browser still being maintained, having started in 1992.

What about those times when lynx just doesn’t cut it, however? When you want to play back YouTube Videos, access web pages using JavaScript to render content, etc?

You’re in luck. browsh, a particular highlight of this collection of unusual command line tools, is a fully-modern text-based browser. It uses Firefox in the backend to render your page in headless mode.

Note: a Pi 4 is recommended to run this particular application, and it still will seem rather slow – you’re asking the Pi to perform some serious heavy lifting with this! But it’s fun and will be useful to users with more powerful systems, I’m sure.

installing browsh

Head on over to the browsh downloads page and get the appropriate package. For example for Debian ARMv7:

cd /tmp
wget https://github.com/browsh-org/browsh/releases/download/v1.6.4/browsh_1.6.4_linux_armv7.deb
sudo apt-get install ./browsh_1.6.4_linux_armv7.deb

This will also automatically pull in Firefox, if you don’t have it yet.

using browsh

browsh https://google.com

and prepare to wait quite a bit.

browsh has good documentation. here are a couple of hints:

  • Use Ctrl+q to exit browsh
  • arrow keys to scroll
  • backspace to go back in history
  • ctrl + l focuses the URL bar

browsh even supports tabbed browsing! Also it supports an interesting technology called mosh which allows for faster, predictive shells over laggy links.

nohup: keep an application running after you leave the SSH session

I remember this as “no hangup”. Usually, when you leave an SSH session, the application which has been running in your session gets a SIGHUP signal. Which will usually lead to the application terminating.

In some cases you would rather not have that – for example, if you’re converting a video, or running a server of some kind, or any other batch process.

prepending the command with nohup will allow it to continue to run, even when the shell is closed, or SSH is disconnected. I usually combine this with an ampersand (&), to start the command in the background:

nohup ./myscript.sh &

lolcat: colorize your shell output. I mean, really colorize it!

Do you sometimes feel that the world, and in particular the shell, lacks color? Worry no more – lolcat to the rescue.

installing lolcat

sudo apt-get update
sudo apt-get install lolcat

using lolcat

lolcat can be used like cat, to output files on your shell:

lolcat /etc/magic

Also – like cat – it can read from stdin, and have input piped into it, to bring a little bit more color into your life:

man lolcat | lolcat
sudo apt-get update | lolcat

cal: built-in calendar

Linux comes with little surprises, like a built-in calendar.


If you want to see the previous and next month to the current month as well, type

cal -3


So there you have it, folks! The ultimate list of all the Linux commands that you never knew you needed!

Looking for more programming tips? Check out our article “9 Tricks with the Python REPL“!


  1. […] if you haven’t yet mastered the ultimate Linux terminal commands, then building a cyberdeck like this is guaranteed to inspire […]

Leave a Comment