There are several tools on Linux that just feel heavenly. Like God bless the developers that coded them. Some of these tools like top and htop handle monitoring, while others like ncdu and df tell you about your disk usage. Find below a list of these tools and how you can make use of them.
ncdu
ncdu falls under the disk usage category. It is an external tool so it doesn’t come with the basic linux binaries. It gives a visual output of the files present in your directories with the ability to go deeper into the tree using your arrow keys. The snippet below shows it indexing a basic node.js setup. Node.js is notorious for having large node_modules directories and this example lives up to that name.
ncdu 1.15.1 ~ Use the arrow keys to navigate, press ? for help
--- /home/osi/codes/summarization -------------------------------------------------------------------------------------------------------------------------------------------
57.2 MiB [##########] /node_modules
12.0 KiB [ ] package-lock.json
4.0 KiB [ ] index.js
4.0 KiB [ ] package.json
df
The df
command allows you to see the space left on your filesystem. It shows all the mounted disk and their associated contribution
top
top
allows you to quickly see which processes are consuming the most amount of memory and CPU. It lives to its name, providing you the top resource consuming processes running on your system. The snippet below shows a snapshot of top showing that Google Chrome and VS Code are consuming the most resources.
top - 04:54:11 up 1 day, 13:57, 1 user, load average: 0.69, 1.24, 1.66
Tasks: 364 total, 1 running, 363 sleeping, 0 stopped, 0 zombie
%Cpu(s): 17.7 us, 5.6 sy, 0.0 ni, 76.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 15864.8 total, 573.3 free, 7078.2 used, 8213.3 buff/cache
MiB Swap: 2048.0 total, 2024.1 free, 23.9 used. 6762.3 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3875 osi 20 0 33.3g 263788 163832 S 13.2 1.6 93:13.16 chrome
13389 osi 20 0 1135.3g 342708 104756 S 11.9 2.1 45:37.13 code
htop
htop
is an advanced version of top
that includes a control interface for process management. You can use htop to force a process to play nicely, end a process, reduce the number of instances, etc.
Conclusion
This post lists out several Linux tools in terms of appearance, use, and application areas. Some of these tools also apply to Linux environments like WSL, allowing Windows users to benefit.