Although the standard Linux utilities have served us well over the years, in some scenarios they fall short. If you’ve ever found yourself writing a one-liner to poll a command or struggling to parse a badly formatted table, then it’s a clear sign that the tools at hand are lacking. What you need are better tools; what I have are better tools—five that will make your Linux life easier.
1
NCurses Disk Usage (ncdu)
To view the sizes of directories, du is a solid choice, and it’s generally the first pick for most people. However, it lacks exploratory capabilities. A few times a year, my system complains to me that it’s running low on disk space, and I find myself exploring the file system to manually delete large directories of accumulated garbage. This is where du lacks, and where ncdu shines.
With its simple interface, ncdu provides blazing-fast exploration to size up directories.
Those familiar with Vim will feel at home because it uses Vim keys for navigation; those who prefer the arrow keys won’t find themselves cursing Vim. Just like terminal-based file managers, you can drill down into directories effortlessly. For each directory, ncdu will display the directory sizes. It’s a simple utility that does one thing and does it well.
Ncdu may be found in the majority of official distribution repositories.
To install it on Debian and its derivatives, e.g., Ubuntu, Linux Mint, etc.:
sudo apt-get install ncdu
To install it on Red Hat and its derivatives, e.g., Fedora:
sudo dnf install ncdu
To install it on Arch and its derivatives:
sudo pacman -S ncdu
2
Btop++
Because it provides a broad overview of my entire system, Btop is easily one of my favorite utilities. It displays bars and charts for CPU, disk, memory, and network utilization. Additionally, the “processes” pane has a top-like interface that allows you to filter and kill individual processes.
To filter processes, press the F key, and to kill the highlighted process, press K.
One of the best things about the Btop interface is how simple it is to adapt it to your needs. Presets are included with Btop, and you can cycle through them by just pressing P. A distinct set of panes is displayed for each preset.
In addition to that, you can enable or disable any pane by pressing a single key. Btop makes it simple to quickly change views over your system’s resources.
The fun does not stop there, because there are (again) Vim keys for those who feel lost without them.
Btop is a significant upgrade over the standard top utility.
It’s available via most native distribution repositories. For some, it’s available in the respective extra repositories. For everyone else, you can install it via Brew or Snap.
3
Bandwhich
Bandwhich is a real-time network monitor that displays live network connections. It differs from netstat because it focuses on active connections in real time. It differs from tcpdump because it’s not an endless stream of packets.
sudo bandwhich
Conveniently, bandwhich offers two simple features to help you capture and view connections. Firstly, you can press Space to pause capture at any moment to obtain a snapshot of connections. Secondly, you can run it in cumulative mode, which progressively adds processes and bandwidth stats to the list without removing them—similar to a log.
sudo bandwhich --total-utilization # Or -t
I prefer Bandwhich over other tools, like tcpdump, because it’s straightforward and convenient, making it possible to quickly identify which processes are contacting the network.
It’s available via the Arch, Nix, Void, and Fedora (Copr) repositories; for everyone else, you can install it via Snap, Cargo, or directly via GitHub releases.
To install it on Debian and its derivatives (e.g., Ubuntu or Mint):
sudo apt-get install ncdu
To install it on Red Hat and its derivatives (e.g., Fedora):
sudo dnf copr enable atim/bandwhich -y
sudo dnf install bandwhich
The Fedora packages are promptly updated. The packages for other RHEL distributions lag behind, and you may find that your distribution release is not yet supported.
To install it on Arch and its derivatives:
sudo pacman -S bandwhich
If you’re having problems installing it and you have a Rust environment set up, you can fall back to cargo:
cargo install bandwhich
4
My Traceroute (mtr)
The MTR command is like a live version of tracepath. Tracepath will ping each network hop sequentially a fixed number of times; MTR will ping every network hop concurrently until stopped. It displays real-time statistics for packet loss, jitter, and latency in a live curses interface.
mtr example.com
Routers often deprioritize ICMP packets, so it’s common to see high packet loss for some hops. Also note that these hops are more likely to throttle ICMP if you’re connecting via a VPN, but it does not mean that you have a connection issue; it just means that you have an ICMP issue. Switching to TCP (-T) or UDP (-u) rarely helps in these cases.
MTR also facilitates reporting. Use the “-w” flag to generate a “wide” report, wide enough to fit host names. Alternatively, use “-j” to output JSON. Set the number of probes with the “-c” flag.
mtr -wc 1 example.com # Wide report; 1 probe.
mtr -jc 1 example.com # JSON report; 1 probe.
The available options are plenty, but a picture is worth a thousand words.
MTR has been around for decades, and it’s available in every distribution repository.
Related
12 Basic Networking Commands Every Linux User Should Know
Simple commands to control and inspect your network.
5
Bandwidth Monitor (bmon)
Bmon is a deceptively simple utility to monitor live bandwidth usage. While it does not show host information like the other tools, its sole focus is on bandwidth.
bmon m
bmon -p 'eth*' # Listen to all hardwired interfaces.
You can see all of your interfaces with ifconfig.
It’s true that Btop++ also provides real-time bandwidth visualizations, but bmon provides some additional network statistics. With bmon open, press D or i, and it will open additional panes with extra context.
One of bmon’s best features is that it’s scriptable. Specific output fields can be defined, formatted, and then processed further using other tools or scripts.
bmon -p 'eth*' -o format:fmt="$(element:name) $(attr:rx:bytes) $(attr:tx:bytes) $(attr:rx:errors)\n"
To see the formatting rules, use the following command:
bmon -o format:help
Bmon has been around for a while, and it’s available in most official distribution repositories.
These tools cannot replace their standard GNU/Linux counterparts; they only address specific gaps. A lot of the standard utilities do not have live, real-time monitoring capabilities, and often we just want to see how our systems change over time. For example:
- Tcpdump emits a deluge of text; I just want to see what’s connecting to the network.
- Du was never designed with “search and destroy” in mind—unlike its dd brethren.
Although the listed tools address very specific needs, they do not address all needs—for that, you will need to keep digging.
Related
Monitor Linux System Performance From the Terminal With These 5 Tools
More tools to monitor your system resources with.
Source link