Some additional command-line tools that I use to install and use on my text client Systems. Initially here were not listed commands that are shipped with every Linux, but the additional tools I install in every Workstation or Server.
To stress a Web Server
Cool compressor better than gzip and that also accepts streams.
Command line / text based Linux Containers monitoring tool
Is the dmi Table decoder.
For example: dmidecode -t memory
Error reporting utility
mc0: 0 Uncorrected Errors with no DIMM info
mc0: 0 Corrected Errors with no DIMM info
mc0: csrow0: 0 Uncorrected Errors
mc0: csrow0: CPU_SrcID#0_MC#0_Chan#0_DIMM#0: 0 Corrected Errors
mc0: csrow0: CPU_SrcID#0_MC#0_Chan#1_DIMM#0: 0 Corrected Errors
mc0: csrow0: CPU_SrcID#0_MC#0_Chan#2_DIMM#0: 0 Corrected Errors
mc1: 0 Uncorrected Errors with no DIMM info
mc1: 0 Corrected Errors with no DIMM info
mc1: csrow0: 0 Uncorrected Errors
mc1: csrow0: CPU_SrcID#0_MC#1_Chan#0_DIMM#0: 0 Corrected Errors
mc1: csrow0: CPU_SrcID#0_MC#1_Chan#1_DIMM#0: 0 Corrected Errors
mc1: csrow0: CPU_SrcID#0_MC#1_Chan#2_DIMM#0: 0 Corrected Errors
mc2: 0 Uncorrected Errors with no DIMM info
mc2: 0 Corrected Errors with no DIMM info
mc2: csrow0: 0 Uncorrected Errors
mc2: csrow0: CPU_SrcID#1_MC#0_Chan#0_DIMM#0: 0 Corrected Errors
mc2: csrow0: CPU_SrcID#1_MC#0_Chan#1_DIMM#0: 0 Corrected Errors
mc2: csrow0: CPU_SrcID#1_MC#0_Chan#2_DIMM#0: 0 Corrected Errors
mc3: 0 Uncorrected Errors with no DIMM info
mc3: 0 Corrected Errors with no DIMM info
mc3: csrow0: 0 Uncorrected Errors
mc3: csrow0: CPU_SrcID#1_MC#1_Chan#0_DIMM#0: 0 Corrected Errors
mc3: csrow0: CPU_SrcID#1_MC#1_Chan#1_DIMM#0: 0 Corrected Errors
mc3: csrow0: CPU_SrcID#1_MC#1_Chan#2_DIMM#0: 0 Corrected Errors
Reports file access events from all running processes in real time.
With flock several processes can have a shared lock at the same time, or be waiting to acquire a write lock. With lslocks from util-linux package you can get a list of these processes.
discard unused blocks on a mounted filesystem (local or remote). Is useful for freeing blocks no longer used in ZFS zvols. That can also be achieved by mount -o discard
Show which processes use the named files, sockets, or filesystems.
Get/set SATA/IDE device parameters
An improved top
id (configure to query OpenLDAP)
To set the metrics of all IPV4 routes attached to a given network interface
To watch metrics for a network interface (or wireless)
CPU and IO devices stats. I modified some collectors for telegraf and influxdb consumed by grafana for fetching the Write KB/s, Read KB/s, Bandwidth of the Magnetic Spinning drives and SSD during declustered rebuild.
Perform network throughput tests
java (jre Oracle and OpenJDK)
ldapsearch and the other tools to work with LDAP.
According to manpages, the opposite of more. :)
What it does is display a file, and you can scroll up/down, you can search for patterns…
cat /etc/passwd | less
# -n doesn’t count the lines, to save time
# For a specific Offset
less -n +500000000P /var/log/apache2/giant.log
# For 50% point
less -n +50p /var/log/apache2/giant.log
Compressor that compresses very efficiently big files, specially GB of of source code.
An utility to send files to the Server through a terminal.
Very useful when you don’t want to scp or rsftp, for example because that requires MFA (Multi Factor Authentication) to be performed again and you already have a session open.
apt install lrzsz
Text browser. really handy.
To trace library calls.
Network tool mix between ping and traceroute.
To see in real time queries and slow queries to mysql
Show the space used by any directory and subdirectory
nginx (fpm-php) and apache
Offers monitoring of different aspects: Network, Disk, Processes…
perf stat ls
PHP + curl + mysql (hhvm)
A parallel, multiprocessor, variant of gzip/bzip2 that can leverage several processors to speed up the compression over files.
If the input looks like a tar archive, it also creates an index of all the files in the archive. This allows the extraction of only a small segment of the tarball, without needing to decompress the entire archive.
postcat -q ID shows the details of a message in the queue
python-pip and pypy
Pipe Viewer – is a terminal-based tool for monitoring the progress of data through a pipeline. It can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion.
dd if=/dev/urandom | pv | dd of=/dev/null
1,74MB 0:00:09 [ 198kB/s] [ <=> ]
Probably you’ll prefer to use dd with status=progress option, it’s just a sample.
It shows the composition of the mail queue.
Access SCSI modes pages; read VPD pages; send simple SCSI commands
Utility to work with partitions that can export and import configs through STDIN and STDOUT to automate partitions operations.
Displays Kernel slab cache information in real time.
Utility for dealing with the S.M.A.R.T. features of the disks, knowing errors…
Split a file into several, based by text lines, or binary: number of bytes per file.
Mount a mountpoint on a remote Server by using SSH.
SSH without typing the password. -f for reading it from a file.
sshpass -p “mypassword” ssh -o StrictHostKeyChecking=no email@example.com
In this sample passing the command ls, so this will be executed, and logout.
sshpass -p “mypassword” ssh -o StrictHostKeyChecking=no firstname.lastname@example.org ls
A poor’s man VPN through SSH that is available for Linux and Mac OS X.
E.g.: sudo sshuttle -r email@example.com:8275 172.30.0.0/16
Sshuttle forwards TCP and DNS but does not forward UDP or ICMP. So ping or ipmi protocol won’t work. But it does work for http, https, ssh…
To trace the system calls and signals.
To redirect the output to another process use:
strace zpool status 2>&1 | less
Shows only strings from a file (normally a Binary)
From package binutils.
systemd-cgtop and systemd-analyze
To see the traffic to your NIC
Reads from sdtin and sends to a file and outputs to stdout as well.
find . -mtime -1 -print | grep -v "/logs/" 2>&1 | tee /var/log/results.log
Kills the process after the indicated timeout.
timeout 1000 dd if=/dev/urandom of=/dev/zvol/carles-N51-C5-D8-P2-S1/gb1000
Tree simply shows the directory hierarchy in a graphical (text mode) way. Useful to see where files and subfolders are.
Make a hexdump or do the reverse
sudo xxd /dev/nvme0n1p1 | less
Just like cat, but for compressed filed.
zcat logs.tar.gz | grep "Error" zcat logs.tar.gz | less
Sergey Davidoff stumbled upon a project called compcache that creates a RAM based block device which acts as a swap disk, but is compressed and stored in memory instead of swap disk (which is slow), allowing very fast I/O and increasing the amount of memory available before the system starts swapping to disk. compcache was later re-written under the name zRam and is now integrated into the Linux kernel.
Whatch allow you to execuate a command and what it (refresh it) at a given intervals, for example every two seconds.
For example, if normally I would do:
while [ true ]; do zpool status | head -n10 ; sleep 10; done
while [ true ]; do df -h; sleep 60; done
while [ true ]; do ls -al /tmp | head -n5 ; sleep 2; done
Then I can do:
watch -n10 zpool status
watch -n60 df -h
watch "ls -al /tmp | head -n5"
For my Dockers, and cloudinit with Ubuntu, my defaults are:
apt update; apt install htop mc ncdu strace git binutils