Having used so many different Linux and UNIX-like environments, I started to really appreciate how useful it is to properly learn how to use the POSIX shell (and a few of the more standard GNU extensions). At some point though, typing convulated combinations of find
, grep
, awk
and sed
commands gets annoying.
In the past 10 years of so, the modern command-line environment is less worried about the UNIX philosophy of small tools built around plain text. And if they do use plain text, they tend to support structured formats like JSON. This means that they're more comfortable in fully using ANSI color codes and UTF-8 formatting when the output is done to the console. They also depend less on system libraries and are often large binaries, especially when built using Go or Rust.
Here are a few of my favorite modern tools I recently started to use. Of course, there are lots more, for example those listed in ibraheemdev/modern-unix, but I limited my list to those I frequently use.
bash-git-prompt. To be used specifically with Bash, this changes the shell prompt when you're inside a Git repository to display Git status information.
ripgrep (command: rg
). This tool is basically a recursive grep over many files. While GNU's grep does support a recursive option, ripgrep is easier to use, takes into account .gitignore
files, supports UTF-8 automatically, supports many compression formats, has a better colorized output and is much faster.
bottom (command: btm
). To quickly look at CPU and memory usage, both top
and the more modern htop
work quite well. But I would often also want to see other metrics, like network and disk usage in a cross-platform way, and without having to install some big system monitoring tool that runs all the time. btm
displays all that, with some interactive graphs, fully colorized and interactive.
bat. A cat
replacement or a pager (like more
and less
), but that has many additional options and supports syntax highlighting of many file types. For example, it can be used as a pager for man
, introducing color and UTF-8 characters to its output. It can easily be integrated with other tools, like ripgrep
, using the scripts in bat-extras.
delta. A colorized viewer of diff
and git diff
, or can be used on its own to compare two files or directories. Its output displays per-character differences, which is greatly helpful when looking for whitespace-only changes. Also does syntax highliting, similar to bat
.
broot (command: broot
or br
). A file navigation interface that makes finding a file in a complex directory structure as simple and quick as possible. It include a file previewer that also works with image files. The br
command is actually a shell function that you can install (for example in .bashrc
) that makes it possible to run a command on the selected file in the current shell after broot
exits. Customization of the "run a command in the shell after exit" can be a bit difficult; Look at my sample configuration file as an example.
curlie. While I really like HTTPie's command-line syntax, it's still a slow and heavy Python 3 script. Curlie lets you use the HTTPie syntax but runs using curl instead and reformats the output to make it similar to HTTPie. You can also get the equivalent curl
command.
Published on September 18, 2021 at 14:20 EDT
Older post: From Remote Desktop to Remote Gaming
Newer post: More Modern CLI Tools