avatarKhuyen Tran

Summary

The article introduces three tools—htop, Baobab, and Stacer—for monitoring and optimizing Linux systems, providing insights into system performance, disk usage, and process management.

Abstract

The article "3 Tools to Monitor and Optimize your Linux System" provides Linux users with valuable information on how to effectively manage their systems. It highlights the importance of understanding system metrics such as CPU and memory usage, disk space consumption, and the impact of running processes. The author recommends three specific tools to achieve this: htop for real-time process monitoring, Baobab for graphical disk usage analysis, and Stacer for comprehensive system optimization and monitoring. Each tool is described in detail, including its purpose, usage, and benefits. The article emphasizes the practicality of these tools in identifying performance bottlenecks, cleaning unnecessary files, and managing startup applications, ultimately enabling users to maintain a more efficient and responsive Linux system.

Opinions

  • The author expresses a preference for htop when diagnosing system slowdowns and for monitoring resource usage during program execution or model training.
  • Baobab is favorably regarded for its ability to visually represent disk usage, making it easier to identify and remove unused large files or applications.
  • Stacer is enthusiastically recommended as a versatile tool for system monitoring and optimization, with features that simplify the management of system services, processes, installed packages, and system cleaning tasks.
  • The author believes that mastery of these tools allows for better prioritization of tasks and the removal of unnecessary applications or processes, leading to improved system performance.
  • The article concludes with a personal note, inviting readers to connect on LinkedIn and Twitter, and to explore the author's repository for related code and articles.

3 Tools to Monitor and Optimize your Linux System

Gain Control over your Machine with These 3 Tools

Image by Author

Motivation

If you are a Linux user, you might want to know some important information about your computer such as:

  • System’s CPU usage, memory usage, and disk usage
  • System information
  • Disk usage of each folder or file and when was the last time that you used them.
  • Memory and CPU consumption of the running processes
  • Startup applications

Knowing those pieces of information will enable you to optimize your system.

In this article, I will show you 3 tools that allow you to do all of the things above and much more!

htop - an Interactive Process Viewer

htop is an interactive process viewer. htop allows you to view information related to command lines such as memory, CPU consumption, and how long it has been running.

I often use this whenever I notice a slow down in the speed of my computer and want to find out which processes have a major impact on the speed. I also use this to monitor how many cores and how much of the memory is being used when running a program or when training a model.

Packages for htop are available in most distros. To run htop, type

htop

You should see something like below:

Image by Author

In the image above, the commands are sorted by CPU%. It seems like the process /opt/brave,com/brave/brave takes the most CPU consumption among all the running processes.

Several shortcuts to try:

  • F4 : Show only processes whose names match the input text
  • F5 : Layout the relations between processes as a tree. Type + or - to expand or collapse a subtree.
  • F6 : On the sorted view, select a field for sorting.
  • Home : Scroll to the top of the process list and select the first process.
  • End : Scroll to the bottom of the process list and select the last process.

View the list of all shortcuts here.

Baobab — Disk Usage Analyzer

If you want to get a graphical presentation of your disk usage, try Baobab. I often use this tool to figure out which applications take a lot of disk usage but haven’t been used for a while. Knowing this helps me to clean the files or folders that I no longer need.

Like htop, Baobab is also available in most distros. To run Baobab, type

baobab

And you should see something like below:

By using the graph to visualize the disk usage of each folder and file, we have a much better understanding of which folders or files take the most disk usage in our computer.

GIF by Author

We can also see the size of the folders or files, how many files they have, and when was the last time they were modified.

Image by Author

Stacer — System Monitor and Optimizer

Stacer is the tool that I am most excited about among the three tools I have introduced so far. It allows you to monitor many important pieces of information such as:

  • System information
  • Download and upload speed
Image by Author
  • Search
  • System services
Image by Author
  • Processes. You can consider this as a simple version of htop . Even though it doesn’t give you as many options as htop , it is easier to use and understand.
Image by Author
  • Installed packages
  • History of CPU and memory
GIF by Author

Stacer also allows you to optimize your computer by:

  • Specifying which applications to start when your computer wakes up
Image by Author
  • Cleaning the system
  • Sending alert messages after the CPU percent, memory percent, and disk percent are below certain percentages
Image by Author

and much more!

You can find how to install Stacer here.

Conclusion

Congratulations! You have just learned how to monitor and optimize your Linux machine using htop, Baobab, and Stacer. Having more control over your machine will enable you to prioritize which tasks to run and remove unnecessary applications or processes.

I like to write about basic data science concepts and play with different algorithms and data science tools. You could connect with me on LinkedIn and Twitter.

Star this repo if you want to check out the codes for all of the articles I have written. Follow me on Medium to stay informed with my latest data science articles like these:

Linux
Ubuntu
Desktop
Operating Systems
Monitoring
Recommended from ReadMedium
avatarTalha Khaild
How to Debug Scripts in Bash

6 min read