Useful Linux Unix Tools to Add to Your Toolbox

Useful Linux Unix Tools to Add to Your Toolbox

Linux / Unix tools in a modern age

2020-11-04

30 years ago software development was very low-level and systems administration was just computer para-scientists. Today with so much high-level technology, many back-end or front-end programmers see the need to learn to use classic UNIX tools such as ps, grep, cat, pkill, and many others but also languages like Go, Rust, Python, and Javascript have been very successful in creating command-line tools with a higher user experience than the old ones. In this way, many programmers choose these new tools much more comfortable, colorful, and in some cases even with better performance.

Here are several tools that help programmer productivity, study routines, write clean code, and even write less and do more:

The Process Status tool

It has been 47 years since the first release of ps (process status) a command-line tool to monitor processes in the operating system, widely used since then, and has not ceased to be important for any programmer and systems administrator.

ps aux

Another very important command-line tool is pgrep to which we give a regular expression as an argument and it returns a list of process identifiers that can be very useful if we want to stop a process or monitor it.

Many of these tools are a little complex to use and in our modern age, a couple of alternatives have begun to appear to improve the developer experience.

Htop

In 2006 Htop was created, a system to debug, monitor, and visualize processes in real-time. It is a user interface where you can run commands like ps, pgrep, pkill without the need to directly type the commands.

htop

Image from the official website https://htop.dev/

In our modern times with the arrival of CLI’s created in languages ​​like Python, Go, Ruby, and Javascript, we can see how more interactive command-line tools have been created that provide a very comfortable user experience.

The arrival of BpyTOP

This repository on github hosts what could be said to be a modern child of htop.

The installation is technically easy, basically, we only need python 3.

A detailed installation guide is in the repository, but basically, it is a pip command to install the package.


pip3 install bpytop --upgrade

bpytop

bpytop

Image from the official repository https://github.com/aristocratos/bpytop

BpyTop has a comfortable user interface to help developers find and manage the process. The interface is a new level of intuition which can help newbie developers to don’t lose their mind and be proactive.

Beyond BpyTop: GoAccess

This is another tool to manage system process with a big difference, can run into the browser.
Yes, GoAccess create a web server with a dashboard to check process.

goaccess

Image from the official repository https://github.com/allinurl/goaccess

This is perfect for virtual machines that have high computing tasks to evaluate the state of the machine and the memory use of the process. As it is written entirely in C, its installation is very easy. You can provide log files from Apache, Nginx, Amazon S3, Elastic Load Balancing, CloudFront, or many others to create metrics and statistics. Can be installed using apt but is recommended using the source code to get a more updated version. Link of installation documentation here. Can be dockerized to use easily in Kubernetes or other container orchestrators.

Knowledge Lack

Currently, there are many different tools and every day new frameworks, cli, libraries, programming languages, ​​and more software are created that we must study to be up to date. This inevitably means that our brain needs to collect more and more information and we will not always be able to retain everything without forgetting other things.

That is why kb was created.

kb is a command line to create and read code fragments and short notes that explain the code, in this way a person can keep in kb his collection of knowledge about some technology that he needs to master like the serverless cli, aws cli, GCP cli, firebase cli, python, ruby, or even Linux / UNIX commands like the aforementioned pgrep, pkill, ps.

The user can create categories like ‘servers‘, ‘tools‘, ‘languages‘, ‘frameworks‘ to create an order and hierarchy of their knowledge.

The installation is very easy, as the github repository states.


pip install -U kb-manager

kb

Image from the official repository https://github.com/gnebbia/kb

If kb is not enough for you to save your knowledge, we have one more option.

cheat.sh

With almost 20,000 stars on Github, this open-source project has a vast database of cheat sheets from different areas such as cloud computing, programming languages, ​​and UNIX / Linux commands.

The best thing is that it does not need an installation, since its database is in the cloud and you can access any cheat sheet using an HTTP client like cURL.

This will give us a small cheatsheet about lambdas functions in python.


curl cht.sh/python/lambda

cheat.sh

The list of cheat sheets is so extensive that we can confidently use cURL and launch a couple of requests to the server that will work perfectly and give us important information on what we are looking for.

  1. curl cht.sh/javascript/async
  2. curl cht.sh / javascript / ajax
  3. curl cht.sh/javascript/json
  4. curl cht.sh/javascript/loop
  5. curl cht.sh/javascript/class
  6. curl cht.sh/python/rest
  7. curl cht.sh/nginx/proxy

Another cheatsheets manager is tldr with perfect support for Windows, Linux, and macOS because the source code is written in Javascript using Node JS. To install yo need Node JS and run this command


npm install -g tldr

Bat and Cat.

Cat, created in 1971, its name derives from concatenate is a UNIX utility to render the content of a file on the command line.

This command has helped us for decades to know what a file contains. But cat falls short of displaying a colored syntax for each different programming language or file format.

Faced with this need we introduce bat, written in Rust, a powerful language.

With an identity interface to cat it provides us with a more comfortable view of the file we are reviewing, it looks more like a text editor than a command line, which increases the user experience and allows better observation of the content of the file.

bat

Image from the official repository https://github.com/sharkdp/bat

Its installation is very easy because it is packaged to be downloaded using a package manager as apt in Ubuntu.

Peace and concentration

In the middle of a modern world, we may have many distractions and perhaps they bother us when working.
Concentration is an open source solution that works in Linux, Macintosh, and Windows. It’s a small tool written in python that allows us to “block” distracting websites, such as Facebook, Twitter, etc.

Its installation is very simple


pip3 install concentration

concentration

Image from the official repository https://github.com/timothycrosley/concentration

A tool to write less and do more

Espanso is a multiplatform text expander, this means that before you finish writing a word it guesses the word and writes the rest for you. This helps you write less and increase productivity when you are coding or writing documents.

espanso

Image from the official repository https://github.com/federico-terzi/espanso

The installation is here available for Windows, Linux, and macOS.

A tool to navigate your filesystem more friendly: Zoxide

In few words, this tool keeps in memory your navigation history and uses a ranking algorithm to help you to go back to a place just written the first letters of the directory.

So if you navigate to /etc /nginx/sites-available and then you go to /home/documents/ but you want to move back to the first place you just need write z et and the algorithm can know which /etc/ match more than /home/documents/ and they going to move you to that directory. Now you can write less and be more intuitive.

zoxide

Image from the official repository https://github.com/federico-terzi/espanso

Be clean and analyze your bash scripts

Shellcheck is a Haskell based beautiful piece of software to check if your bash scripts have bad practices or vulnerabilities. You can add this to your Dev Ops pipelines to avoid deploy poor quality bash scripts which can decrease the safety of your product.

Shellcheck

This tool also helps newbies and advanced developers to get more experience creating clean code in bash, a skill very underrated but highly powerful. Necessary in order to be able to master UNIX systems with confidence.

Analyze and optimize SQL syntax

SOAR is an open-source project created by Xiaomi to evaluate and optimize SQL queries.

It can be used on Linux, Mac, and Windows and is excellent to use in continuous integration pipelines to check the quality of SQL queries. This can help large teams keep the quality of their queries as good as possible.

This is the installation link

Closing words

Although it is impossible to stop using the classic UNIX tools (because they are simply perfect for many of our use cases), we can choose to experiment and update our toolset with these small open source projects. Those can make us feel like we have little superpowers to be more productive and write less on the keyboard.

Without a doubt, every day we must let the machines help us do our work.