16 days ago 36524 views

Unix System Monitoring and Diagnostic CLI Tools

Originally published 2020-09-01 on blog.sweeting.me, updated sporadically since then.
Also published on the Monadical Blog, HackerNews, and /r/Sysadmin.



An opinionated list of CLI utilities for monitoring and inspecting Linux/BSD systems.

A similar list is available for macOS here: awesome-macos-command-line.



Getting Started

CLI Usage Reference Tools:

My own personal helper script collections for Bash & Fish + reading lists & resources:

Guides:

And More…

Below is a collection of CLI tools that I’ve personally used while doing Linux/BSD systems administration over the past 10+ years. Some of them I use daily, others I only use once a year or less… but when I need them, boy am I glad they exist!

On non-Ubuntu/Debian-based Linuxes you should replace any instance of apt install xyz below with pkg install xyz/brew install xyz/yum install xyz/nix install xyz/etc. depending on your respective system.

If you would like to suggest changes/additions to this list you can comment on Reddit, ping me on Twitter @theSquashSH, or find my contact email on sweeting.me.


All-in-one tools

glances ⭐️ 🌈

htop, iftop, iotop, gpustat, ctop, and more, all rolled into one tool.
Prints pretty much everything you need to know at a glance, including container resource usage, active processes, network and disk IO usage, and other stats.

pip install 'glances[action,browser,cloud,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi]'

# launch glances CL
glances

# start a webserver to view glances output in a web UI on http://0.0.0.0:8787/
glances -w -B 0.0.0.0 -p 8787

nmon 🌈

Jack-of-all-trades tool similar to glances, but with an interactive CLI UI to switch between panes for each type of resource.

# run nmon then press c/m/r/etc to enable/disable each pane in the ncurses UI
nmon

dstat

A minimalist utility that prints a colored one-line summary of system stats every second.

# give an update of cpu, disk, and network usage every 5sec
dstat -cdn 5

# show advanced cpu, filesystem, ipc, locking, and asyncio stats every 2sec
dstat --cpu-adv --fs --aio --ipc --lock 2

atop

POTENTIALLY COMPROMISED? ☠️

https://rachelbythebay.com/w/2025/03/25/atop/

Great for finding out what’s causing system-wide slowness when you’re not sure whether what the culprit is (e.g. CPU/disk/network/temperature/hardware/etc.).

Ranks all possible sources of slowness independent of individual processes, highlights potential bottlenecks or high resource usage areas in red. Very useful when you can’t tell what’s causing slowness from htop alone.

apt install atop

# show all processes and individual threads
atop -y

tiptop/mactop 🌈

tiptop is a command-line system monitoring tool in the spirit of top. It displays various interesting system stats and graphs them. Works on all operating systems.

pip install tiptop
tiptop

osquery ⭐️

Run SQL queries on your system setup and resources.

# show all processes listening on local ports 
osqueryi "SELECT DISTINCT
        process.name,
        listening.port,
        process.pid
    FROM processes AS process
    JOIN listening_ports AS listening
    ON process.pid = listening.pid
    WHERE listening.address = '0.0.0.0'"
    
# show all gateway routes to the internet in json format
osqueryi --json "SELECT * FROM routes WHERE destination = '::1'"

# show number of threads by process name
osqueryi 'SELECT count(pid) AS total, name FROM processes GROUP BY name ORDER BY total desc LIMIT 10'

sar

apt install sysstat
echo 'ENABLED="true"' > /etc/default/sysstat
systemctl restart sysstat

# print all basic stats every 1sec
sar -A 1

# show network stats by interface/device every 2sec
sar -n DEV 2

# show all available stats every 1sec
sar -B -b -d -I ALL -m ALL -n ALL -q -r ALL -S -u ALL -v -W -w -y 1

landscape-sysinfo

Ubuntu’s builtin system status summary tool that displays whenever you SSH in.

landscape-sysinfo

webmin/cockpit ⭐️ 🌈

Web GUI system control panels.

curl -fsSL 'http://www.webmin.com/jcameron-key.asc' | apt-key add -
echo "deb http://download.webmin.com/download/repository/ sarge contrib" \
     "deb http://webmin.mirror.somersettechsolutions.co.uk/repository/ sarge contrib" | tee /etc/apt/sources.list.d/webmin.list
apt install webmin
apt update

CPU / Memory

lscpu

Show info about the available CPU slots and installed CPUs.

apt install util-linux

lscpu

lsmem

Show info about the available RAM slots and installed chips.

apt install util-linux

lsmem -a

top

Barebones process resource usage monitoring.

apt install top

top

htop ⭐️ 🌈

A better version of top.

apt install htop

htop

mpstat

Show per-core CPU usage statistics including IO load, interrupt load, system load, user load, etc. Gets its data from /proc/stat.

apt install sysstat

# show all stats every 1sec
mpstat -A 1

# show utilization of all processors on the system every 1sec
mpstat -P ALL 1

btop++ ⭐️ 🌈

# install btop from github

btop

https://github.com/aristocratos/btop

pidstat

Show per-process CPU usage statistics including IO load, interrupt load, wait time, etc. Gets its data from /proc/<pid>/stat.

apt install sysstat

# show stats for each pid with human-readable sizes and full commands w/ args
pidstat --human -l

# show reports of page faults and memory statistics for PID 1234 every 2sec
pidstat -r -p 1234 2

free

Show RAM and SWAP usage information.

# show RAM and SWAP usage info along with buffer/cache stats and totals
free -h -t -l

vmstat

Show virtual memory, buffer, cache, and paging information.

apt install sysstat

# show all virtual memory stats in megabytes every 1sec
vmstat -S M -a 1

# show aggregate statistics and totals
vmstat -s

# show disk-related virtual memory access statistics
vmstat -d

tsubame 🌈

memray 🌈

Fancy memory profiling TUI for python. It can track memory allocations in Python code, in native extension modules, and in the Python interpreter itself.


GPU

gpustat

(Only works for NVidia GPUs.)

pip install gpustat

# print GPU performance stats with color every second
watch -c gpustat -cp --color

intel_gpu_top

Show GPU usage stats for Intel, NVidia, or Radeon GPUs.

apt install intel-gpu-tools

intel_gpu_top

nvtop

apt install nvtop

nvtop

radeontop

apt install radeontop

radeontop

nvidia-smi

Monitor NVidia hardware sensor values (e.g. temperature, frequency, etc.).

apt install nvidia-smi

# print nvidia performance and sensor stats every second
nvidia-smi -l 1

# print nvidia utilization stats for GPU 0 every second
nvidia-smi -q -g 0 -d UTILIZATION -l 1

glmark2

Stress-test GPU performance.

apt install glmark2

glmark2

glxgears

Stress-test GPU performance.

apt install mesa-utils

glxgears

Filesystem

iotop ⭐️

Ranks processes by disk IO usage and throughput in realtime.

ioping

Check the response time of a given device or socket. <1ms times with low variance are indicators of a healthy storage device.

apt install ioping

ioping /dev/sda

lsof ⭐️

View processes actively reading/writing/locking a given path or device.

lsof +D /some/path/here

# see which processes are actively using a connected USB drive
lsof +D /media/usb

# see which processes are actively using nvidia GPUs
lsof /dev/nvidia*

fuser

View processes actively reading/writing/locking a given directory or path.

fuser -a -v -u /some/path/here

blktrace

Prints all disk-read events happening on the system.

sudo blktrace -d /dev/nvme0n1 -a read -o - | blkparse -i -

debugfs

Translate between block numbers, inode numbers, and file paths.

debugfs -R 'icheck 536514808' /dev/nvme0n1
# debugfs 1.46.5 (30-Dec-2021)
# Block   Inode number
# 536514808   8270377
 
debugfs -R 'ncheck 8270377' /dev/nvme0n1
# debugfs 1.46.5 (30-Dec-2021)
# Inode   Pathname
# 8270377 /home/ubuntu/.questdb/db/table_name/2022-10-04/symbol_col9.d.1092

iostat

View IO usage stats and avg response times for a given drive in realtime.

# show io stats in human readable sizes for all devices
iostat -d -m

# show extended stats (w/ human readable sizes) for /dev/sda every 1sec
iostat -d -m -x 1 /dev/sda

d_await is the avg time it took to respond to IO in ms (lower is better)
%util is the percent utilization (lower is better)

zpool iostat ⭐️

View realtime ZFS IO stats for a pool.

zpool iostat -v poolnametotest 1

nfsiostat

View realtime NFS IO stats.

apt install nfs-common

# show NFS IO stats sorted by operations per second every 1sec
nfsiostat -s 1

# show NFS IO stats for the mount /mnt/nfs-drive
nfsiostat /mnt/nfs-drive

cifsiostat

View realtime CIFS IO stats.

apt install sysstat

# show human-readable CIFS IO stats in megabytes every 1sec
cifsiostat -h -m 1

hdparm

One-off command to test disk read/write speed.

hdparm -Tt /dev/sda

bonnie++

One-off command to test disk read/write speed at a variety of block sizes.

# bonnie++ -d [TEST_LOCATION] -s [TEST_SIZE] -n 0 -m [TEST_NAME] -f -b -u [USER]

# simple example with a 1 gigabyte test file on /media/somedisk
bonnie++ -d /media/somedisk -s 1G ...

# full example with a 4 gigabyte test file on 
bonnie++ -d /media/somedisk -s 4G -n 0 -m TEST -f -b

dd ⭐️

The jack-of-all-trades tool dd can also be used for simple disk speed tests.

# create a ramdisk with a large test file in it
#  this is needed to avoid being CPU or disk-speed limited
#  when reading our random test data to write during the test
mkdir /mnt/ramdisk
mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
dd if=/dev/urandom of=/mnt/ramdisk/testfile bs=1M count=1024 status=progress

# to test the write speed of a disk
sync
dd if=/mnt/ramdisk/testfile of=/mnt/disktotest/testfile bs=1M count=1024 oflag=dsync status=progress

# to test the read speed of a disk
echo 3 > /proc/sys/vm/drop_caches
dd if=/mnt/disktotest/testfile of=/dev/null bs=1M count=1024 status=progress

rsync/rclone/rsnapshotd/sanoid+syncoid

Backup and file syncing tools.

apt install rclone rsync rsnapshotd

# sync some local files to a remote server over ssh/rsyncd
rsync --archive --info=progress2 /some/local/path user@host:/some/remote/path

# sync some local files to a remote directory on a cloud storage provider
rclone sync source:path dest:path [flags]

# mount remote dir as a local FUSE filesystem
rclone mount remote:path/to/files /path/to/local/mount

# take an rsync+hardlink snapshot of all the sources set in /etc/rsnapshot.conf
rsnapshot

# or take a zfs snapshot of a given pool/dataset
zfs snapshot -r poolname/dataset@snapshotname

gddrescue/dd_rescue/ddrescue-gui/recoverdisk/safecopy/recoverypy

df

Show the space available on a given filesystem.

df -h /

ncdu ⭐️🌈

Analyze a directory to find all the largest files.

# show tree of largest files and dirs on / filesystem
ncdu -x /

# show tree of largest files and dirs in all filesystems below /mnt
ncdu /mnt

find

# list files ordered by modified date from most recent to least recently modified
find /some/path -mtime -1 -lsblk

parted

# list all drives and partitions
parted /dev print all

blkid

# list all partitions with their UUIDs, filesystem types, and labels
blkid

lsblk ⭐️

# show the partition tree with filesystem types, mountpoints, permissions, and sizes
lsblk -f -m

# show drives only with no partitions or headers
lsblk --nodeps --noheadings

lsscsi

apt install lsscsi

# list all drives with info about size, disk id, etc.
$ lsscsi -s  -P -p -g -i -D
[0:0:0:0]    0x0     ATA      CT120BX300SSD1   010   /dev/sda   -  /dev/sg0   -          none              -      120GB
[2:0:0:0]    0x0     ATA      CT2000BX500SSD1  030   /dev/sdg   -  /dev/sg6   -          none              -     2.00TB
[2:0:1:0]    0x0     ATA      Samsung SSD 860  1B6Q  /dev/sdh   -  /dev/sg7   -          none              -      500GB
[2:0:2:0]    0x0     ATA      Samsung SSD 860  1B6Q  /dev/sdi   -  /dev/sg8   -          none              -      500GB
[2:0:3:0]    0x0     ATA      WDC  WDS100T2B0A 00WD  /dev/sdj   -  /dev/sg9   -          none              -     1.00TB
[2:0:4:0]    0x0     ATA      WDC  WDS100T2B0A 00WD  /dev/sdk   -  /dev/sg10  -          none              -     1.00TB
[2:0:5:0]    0x0     ATA      WDC  WDS100T2B0A 00WD  /dev/sdl   -  /dev/sg11  -          none              -     1.00TB
[3:0:0:0]    0x0     JMicron  Generic DISK00   0103  /dev/sdb   JMicron_Generic_DISK00_0123456789ABCDEF-0:0  /dev/sg1   -          none              -     8.00TB
[3:0:0:1]    0x0     JMicron  Generic DISK01   0103  /dev/sdc   JMicron_Generic_DISK01_0123456789ABCDEF-0:1  /dev/sg2   -          none              -     8.00TB
[3:0:0:2]    0x0     JMicron  Generic DISK02   0103  /dev/sdd   JMicron_Generic_DISK02_0123456789ABCDEF-0:2  /dev/sg3   -          none              -     8.00TB
[3:0:0:3]    0x0     JMicron  Generic DISK03   0103  /dev/sde   JMicron_Generic_DISK03_0123456789ABCDEF-0:3  /dev/sg4   -          none              -     8.00TB
[3:0:0:4]    0x0     JMicron  Generic DISK04   0103  /dev/sdf   JMicron_Generic_DISK04_0123456789ABCDEF-0:4  /dev/sg5   -          none              -     10.0TB

fdisk ⭐️🌈

# list detailed information about disk device models, sector alignment and sizes, partition maps, partition types, block sizes
fdisk -l

zfs/nfs/samba/glusterfs

Alternative filesystems / fileshares besides ext4.


Network

nethogs ⭐️🌈

Show a list of processes sorted by network activity in realtime.

apt install nethogs

# show process traffic across all interfaces
nethogs

# show process traffic between all hosts on eno2 in promiscous mode
nethogs -p eno2

iftop

Lists active network connections sorted by activity level in realtime.

# show all connections with ports
iftop -P

# show only connections on eno1 to/from 192.168.1.10
iftop -P -i eno1 -f "host 192.168.1.10"

# show traffic between all hosts on eno2 in promiscuous mode (if available)
iftop -P -i eno2 -p

# when inside of tmux/screen you may need to set TERM manually for pretty output
env TERM=xterm-256color iftop

iptraf-ng🌈

Show a real-time updating list of all connections by host iftop, with a log of the packets being sent. Can also show a statistical summaries of traffic per-host, per-interface, or per-packet-type.

iptraf-ng

pktstat

Display list of active connections including any HTTP requests within each connection.

# list active connections and requests on all interfaces sorted by traffic volume
pktstat -t

# list active connections and requests on eth0 with full hostnames and Byte totals
pktstat -i eth0 -t -B -F -T

speedometer / nload / bmon / slurm / bwm-ng / cbm / netload / ifstat / etc. 🌈

Show realtime staticstics/graphs of total network traffic on the system.
These all work similarly and can be installed via most system package managers.

# Show a fancy colored realtime graph of sent and received traffic on eth0
speedometer -r eth0 -t eth0

netstat ⭐️

View information about processes bound to ports and active network connections.

# list processes listening on all ports (UDP & TCP, IPv4 & IPv6)
netstat -tulpn

# list all active connections with their current status
netstat -tupn

# list all active connections with their current status and realtime updating
netstat -tupnc

# show summary stats each type of socket
netstat -i

# show summary stats for type of protocol
netstat -s

# or show socket stats using ss
ss -s

ethtool

Show information about the kernel module / driver powering a given network interface.

apt install ethtool

# show speed, duplex, and additional metadata for eth0 interface
ethtool eth0

# show feature flags status for eth0 interface
ethtool -k eth0

# show transfer stats for eth0 interface
ethtool -S eth0

# show the eth0 driver / kernel module
ethtool -i eth0

# identify the physical eth0 ethernet port by blinking its LED
ethtool -p eth0

ip/ifconfig

View network interface and routing table information.

# print entire routing table
ip route
# or on BSD systems
route -n

# get the default "next hop" route for the end destination 192.168.1.2
ip route get 192.168.1.2
# or on BSD systems
route get 192.168.1.2

# interface info with human-readable sizes for the eno1 interface
ip -s -h link show eno1
# or on BSD systems
ifconfig eno1

# show transfer stats for each interface
ip -s link
# or on BSD systems
ifconfig

ping/tcping/arping

Basic ICMP/TCP/ARP ping utilities (you cant ping over UDP unless you have a process running on the server to send back a UDP response, like iperf).

apt install ping

# ping a given IP/host 10 times using ICMP with a 5sec timeout for each packet
ping -c 10 -t 5 <IP/host>
apt install tcping
# send 10 TCP packgets to a given IP/host:80 with a 1sec delay between each
tcping -ip <IP/host> --port 80 --number 10 --sleep 1000
apt install arping

# ask peers on the network for the MAC address associated with 192.168.1.2
arping 192.168.1.2

# check for duplicate responses for the IP 192.168.1.5 (to detect ARP spoofing)
arping -d 192.168.1.4

arpwatch

Monitor new ARP cache entries broadcased by devices on your local network.

apt install net-tools arpwatch

# show new ARP mappings announced on eth0 interface
arpwatch -i eth0

# show entire arp table
arp -a -v

# print only the arp entries for the host 192.168.1.2 on the interface eno1
arp -i eno1 -a 192.168.1.2

iperf/iperf3 ⭐️

One-off command to test network speed over a single/multiple connections.

apt install iperf

# on the server
iperf -s

# on the client
iperf -c <ip/host of server>
apt install iperf3

# on the server
iperf3 -s

# on the client
iperf3 -c <ip/host of server>

(make sure to swap the client & server to test in both directions for the most accurate results)

nuttcp

One-off command to test network speed with advanced options for TCP/UDP bursting, timing, packet sizes, and more. Better than iperf for stress testing network edge-conditions, buffer sizes of intermediate devices, or extremely high-bandwidth links.

apt install nuttcp

# on the server
nuttcp -S

# on the client
nuttcp -i1 <ip/host of server>

# send 300 Mbps of UDP traffic in bursts of 50 packets for 5 seconds
nuttcp -u -Ri300m/50 -i 1 -T5 <ip/host of server>

# saturate a 10Gbit connection with a 9K MTU using max-size UDP packets (len=8972)
nuttcp -l8972 -T30 -u -w4m -Ru -i1 <ip/host of server>

speedtest-cli

A CLI to test your internet speed using the speedtest.net service.

pip install speedtest-cli

speedtest-cli

dig/dug/dog/host/nslookup/doggo 🌈

You can test DNS record resolution, trace, and speed stats using dig or dog.

apt install dnsutils

# simple example using system default resolver
dig -4 +trace example.com

# full example using 1.1.1.1 as the resolver with DNSSEC checking
dig -4 +dnssec +multi +trace @1.1.1.1 example.com

# get your public IP address using the opendns reflector resolver
dig -4 +short myip.opendns.com @resolver1.opendns.com

# get pretty colorized output optimized for human-readability
dog example.com A @1.1.1.1

host -t A example.com
nslookup example.com
curl -s ipinfo.io

mtr ⭐️

Traceroute tool that shows realtime ping speed to all hops between you and a destination in realtime.

apt install mtr

# Simple trace of connection to example.com using ICMP
mtr example.com

# Full trace showing AS numbers, IP addresses, and ICMP extension info
mtr --show-ips --aslookup --mpls --max-ttl 20 example.com

# Trace using TCP port 80 instead
mtr --tcp --port 80 example.com

# Trace using UDP port 
mtr --udp --port 80 example.com

nmap ⭐️

Jack-of-all-trades port-scanner, network scanner, fingerprinter, and network tester.

apt install nmap

# scan all TCP ports on a given host
nmap -p 1-65535 -T4 -A -v <IP/hostname>

# detect host OS and protocols on open ports
nmap -sO <IP/hostname>

tcpdump + wireshark

Collect a dump of all packets sent/received and inspect their contents.

# capture all packets on eth0 port 80, without resolving hostnames/ports
tcpdump -i eth0 -nn -s0 -v port 80

# show all HTTP GET/POST requests on all interfaces
tcpdump -s0 -v -n -l | grep -E -i "POST /|GET /|Host:"

# capture all packets on eth0 and write them to test.pcap
tcpdump -i eth0 -s0 -w test.pcap

# open a given pcap capture file in the wireshark GUI
wireshark -r test.pcap

ssldump

ssldump -k cert.key -i eth0 -dn host 123.123.123.123 and port 443

wsrepl 🌈

Interactive REPL for websocket exploration.

iptables/iptables-tui

Interactive TUI to explore iptables.

impala 🌈

TUI for managing Wifi on Linux

cargo install impala

impala

Hardware

sensors

Monitor hardware sensor values (e.g. temp, frequency, etc.).

apt install lm-sensors
sensors-detect

watch sensors

ipmitool

Show additional sensor values not accessible to lm-sensors.

apt install ipmitool

# show all sensor values including voltage, current, temp, fan speeds, etc.
ipmitool sensor

# show ambient air temperature
ipmitool sdr type temperature | grep 'degrees C'

# get chassis hardware and power status information
ipmitool chassis status

i7z

Show the the C-states and temperature for i3, i5 and i7 based Core processors from Intel.

apt install i7z

i7z

cpufreq-info ⭐️

Show information about current CPU frequency, hardware limits, active governor policy, and more.

apt install cpufrequtils

# view CPU frequency info
cpufreq-info

# set upper CPU frequency limit to 1.6Ghz
cpufreq-set -u 1.6Ghz

# set the governor to userspace-controlled frequency with a constant 800Mhz frequency
cpufreq-set -g userspace
cpufreq-set -f 800Mhz

cpupower

Get information about CPU clock speeds, governors, and power modes.

# show information on frequencies, turbo-boost, and transition speeds of installed CPUs
cpupower frequency-info

# show information about available idle states of installed CPUs
cpupower idle-info

# show per-core breakdown of usage, frequency, clock speed, and idle stats
cpupower monitor

powertop ⭐️

Monitor CPU power consumption and power management on Linux.

apt install powertop

# show breakdown of power usage per-process in watts, cpu usage time, events/s and more
powertop

dmidecode

# show SMBIOS data from sysfs about CPU sockets, vendors, architectures, available feature flags, versions, clock speeds, hyperthreading, turbo-boost, and more
dmidecode -t 4

# show system hardware summary
dmidecode --type system -q

# show processor hardware summary
dmidecode -q --type processor

# show memory hardware summary
dmidecode -q --type memory
dmidecode --type 17
free -m -h -t

smartctl ⭐️

Monitor disk SMART sensor values and statuses (e.g. temp, power-on hours, write errors, etc.).

apt install smartmontools

# get all the SMART values and information for /dev/sdc
smartctl --all /dev/sdc

apcaccess status

Monitor UPS power usage, battery level, voltage, and other stats.

apt install apcupsd

# enable in config
 echo "UPSCABLE usb" >> /etc/apcupsd/apcupsd.conf
echo "UPSTYPE usb" >> /etc/apcupsd/apcupsd.conf
echo "DEVICE" >> /etc/apcupsd/apcupsd.conf
echo "ISCONFIGURED=yes" > /etc/default/apcupsd
systemctl enable apcupsd
systemctl start apcupsd

# show curent power draw, max power draw, battery level, voltage, runtime, etc.
apcaccess status

lshw ⭐️

Show the entire hardware information tree with all info.

lshw

# less verbose output
lshw -short

# fetch SCISI, USB, PCI, etc. extended bus information
lshw -businfo

# output an HTML summary
lshw -html > hardware.html

lsusb

Show information about attached USB devices and connection topology.

# show all USB device info in tree format including vendor information
lsusb -v -t

usb-devices ⭐️

List attached USB device BUS IDs + type, device IDs, vendor IDs, serial numbers, driver, feature flags, and power consumption info.

usb-devices

camcontrol

Show information about available hardware on FreeBSD systems using the CAM system.

camcontrol devlist

dmesg ⭐️

View kernel log output related to hardware devices, including connection/disconnection events, errors, warnings, debug info, and more.

dmesg

last

Show information and logs from the most recent boot.

# show last boot log w/ init level changes, full usernames, and timestamps
last -x -w -F | tac

VM / Docker

ctop ⭐️🌈

htop equivalent for monitoring containers, works for Docker and runC and has pretty colors.

brew install ctop

# show performance stats, entrypoint, and health of all active containers
ctop -a

(see glances for htop + ctop all-in-one)

docker stats

The docker equivalent of top. Uncolored output, one row per container.

docker stats

docker compose stats

virt-top

Monitor performance statistics of virtual machines on a KVM host.

apt install virt-top

virt-top

esxtop

Monitor performance statistics of virtual machines on an ESXi host.

ssh someuser@esxi-host esxtop

DB / Webserver

pg_top ⭐️

Show PostgreSQL performance information.

apt install pgtop

# connect to postgres@localhost:5432/example and show perf stats w/ color
pg_top --color-mode -h localhost -p 5432 -d example -U postgres

mytop

Show MySQL performance information.

apt install mytop myps

# connect to mysql@localhost:3306/example and show perf stats w/ color
mytop -color -h localhost -P 3306 -u mysql -d example

redis-stat

Show Redis performance information.

gem install redis-stat    # also available as a JAR file

# show performance stats of a redis db on localhost:6380 every 1sec
redis-stat --verbose localhost:6380 1

# you can also use redis's built-in monitoring commands
redis-cli INFO
redis-cli MONITOR

ngxtop ⭐️

Show Nginx performance information.

pip install ngxtop

# show summary of performance and breakdown by request URL
ngxtop

# show summary of usage by client IP
ngxtop top remote_addr

# show 4xx/5xx responses by referrer
ngxtop -i 'status >= 400' print request status http_referer

apachetop

Show Apache performance information.

apt install apachetop

# show performance statistics parsed from the example.com access_log
apachetop -f /var/www/vhosts/example.com/statistics/logs/access_log

uwsgitop

Show uWSGI performance information.

pip install uwsgitop

# enable the stats socket on the server
uwsgi --module myapp --socket :3030 --stats /tmp/stats.socket

# then connect to it with uwsgitop
uwsgitop /tmp/stats.socket

OS / System

nala 🌈

Prettier drop-in replacement frontend for the apt package manager. Provides faster parallelized downloads, better progress bars, extra helpers, etc. on top of apt.

apt install nala

# then use it in place of apt:
nala update
nala install python3 nodejs

uname

Get active kernel and architecture information.

uname --all

# or to only get architecture
arch

lsmod

Get active kernel module list.

lsmod

lsb_release

Get Ubuntu version info.

lsb_release --all

watchdog/auditd/acct

System event monitoring, audit logging, alerting tools, etc.

apt install watchdog auditd acct

# read documentation for more info
man watchdog
man auditd
man acct

systemd-analyze / isd

Useful for track down the cause of slow boots and other startup service issues.

# list all processes that started at boot, ordered from slowest to fastest
systemd-analyze blame

# plot the services that ran at boot as a pretty SVG with colors
systemd-analyze plot > boot-trace.svg

# see what security permissions the docker service has enabled
systemd-analyze security docker

# use a nice TUI to browse and manage systemd units
isd

dpkg/apt list/apt-file/apt-mark

Other useful apt-related package management commands.

apt list --installed
apt-mark showmanual

apt show <packagename>
dpkg -L <packagename>
apt-file search <filename>

Profiling / Debugging

pv/progress ⭐️

Show progress of cp, mv, etc. file transfer operations, pipe operations, etc.

apt install pv progress

cat some_large_file.txt | pv | gzip -9 > compressed_file.txt.gz

cp compressed_file.txt.gz /some/other/location
progress

strace/dtrace/dtruss ⭐️

Trace the system calls of a given process to watch what it’s doing internally.

# Run `ls /home` and print all system calls to stdout
strace ls /home

# Print 'open' or 'read' system calls with timestamps
strace -t -e open,read ls /home

# Attach to a running process by PID
strace -p 1234

(dtrace is the macOS/BSD equivalent to strace)

ltrace

Trace the dynamic calls made to shared libraries to see how processes are using shared libs.

# attach to a specific PID and show call names with start timestamp and duration
ltrace -t -T -p 1234

# Run `docker ps` and only show calls made to the libselinux.so dylib (with timestamps)
ltrace -t -T -l /lib/libselinux.so.1 docker ps

binwalk/strings/hexyl/hexabyte/dissy 🌈

Decompiler utility normally used to inspect firmware binaries, but is useful along with strings to see what a binary contains before you run it.

pip3 install 'git+https://github.com/ReFirmLabs/binwalk.git'

# extract the full root filesystem from a firmware image binary
binwalk --extract some_firmware.bin

# show machine instructions used in a given firmware
binwalk --opcodes some_executable.bin

# show all strings found inside a binary blob
strings some_binary_blob.exe

# show hex dump explorer with pretty color highlighting
hexyl /bin/some_binary.exe

Shell Utilities

bat/pygmentize/grc/colortail/rich/imgcat/timg ⭐️🌈

Tools to help you generically colorize the output any command. Great for printing logfiles, source code, config files, tracebacks, etc. any other structured data with syntax highlighting.

bat < docker.log
docker compose logs | grc
pygmentize -g < somecode.py
...

iTerm2/fig ⭐️ 🌈

Alternative Terminal Emulator applicaitons with tons of extra features.

fish/fisher/fifc ⭐️ 🌈

apt install fish
fish
curl -fsSL 'https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish' | source
fisher install jorgebucaran/fisher
fisher install gazorby/fifc

Alternative to traditional bash shell with better autocomplete, image viewing support, user-installable plugins, and other features.

tmux/tmux2html

apt install tmux

# stream your tmux window as a live-updating HTML UI on http://0.0.0.0:8000
pip install tmux2html
tmux2html -o index.html --stream --interval 1 0
python3 -m http.server --directory . --bind 0.0.0.0 --port 8000

atuin ⭐️🌈

Improved shell history manager that can also sync history between machines (encrypted).

bash <(curl https://raw.githubusercontent.com/atuinsh/atuin/main/install.sh)
atuin status
atuin help

shellcheck ⭐️

apt install shellcheck
shellcheck /some/bash/script.sh

Best linter available for bash scripts with hundreds of checks for common mistakes.

ag/ripgrep/ack/ugrep ⭐️

grep -r/git grep replacement with much faster performance and additional features.

apt install silversearcher-ag

ag 'some-regex' .

autojump/z/zoxide/aj/pj/fasd/j ⭐️

Cd into recently used directories quickly (fuzzy-matched).

eza/exa/lsd/lsp/broot/fzf/browsr 🌈

cd and ls replacements.

brew install eza

eza --header --group-directories-first -s name \
    --time-style=long-iso --created --modified \
    --all --long --extended --group --git --classify --icons \
    --ignore-glob=.DS_Store \
    /some/directory/path

micro/most/toolong/logmerger 🌈

nano, cat, and less alternatives with multi-cursor selection, syntax highlighting, mouse support, and more.

pipx install toolong
apt install bat most
brew install micro

tl /path/to/some/file.js
tl access.log* --merge

most /path/to/some/file.js
bat /path/to/some/file.js
micro /path/to/some/file.js

jq/yq/jsome/mlr/confget/plutil/pup/peco/glow/hexyl

Command-line parsers and manipulators of JSON, YAML, XML, CSV, INI, and PLIST formats.

watch/timeout/wait/mkfifo/nohup/disown/bg/fg/jobs

Watch the output of any command for changes and highlight the diff, useful in conjuction with other tools below.

# show changes in the output of `ip -s link show eno1` highlighting network IO
watch -n1 -d ip -s link show eno1

# show changes in the output of `lsof +D /mnt/somedrive` highlighting accesses
watch -n1 -d lsof +D /media/usb

# run a long-running command with a given timeout
timeout 10 wget 'https://example.com/some/large/file'

# wait for a pid to finish running and exit with its return status
wait 123

# create a fifo pipe for inter-process communication
mkfio /tmp/testpipe
mknod /tmp/testpipe p

op/passman/keyring/uuidgen/openssl/mkcert/certbot

Password, secret, and token generators/managers.

openssl rand -hex 20
# 8ca5a28c055a766aa5a676fff24a9755fdd113f4




Further Reading