linux monitoring system

Linux Basics: Using System Monitoring Tools

Using essential system monitoring tools in Linux, including top, htop, free, iostat, vmstat, and netstat.

TL;DR:


This guide aims to cover essential system monitoring tools in Linux, including top, htop, free, iostat, vmstat, and netstat. These tools help you monitor system performance such as CPU usage, memory usage, network statistics, and more.

Introduction

Understanding system performance is a key part of managing a Linux system. Luckily, Linux provides a rich set of command-line tools that can provide comprehensive real-time information about the state of the system. This guide will cover some of the most commonly used tools: top, htop, free, iostat, vmstat, and netstat.

Top and Htop

Using Top

The top command provides a real-time, dynamic view of the processes running on your system. It displays information about CPU usage, memory usage, and more for each process.

top

Using Htop

htop is an advanced, interactive system monitor that is a replacement for the top command. It offers many improvements, including the ability to scroll horizontally and vertically to see all processes and complete command lines.

htop

If htop command is not found you can do this for Debian / Ubuntu based systems.

Free

The free command gives you a brief summary of your system’s memory usage, including physical memory, swap memory, and buffers used by the kernel.

free -h

Iostat

iostat reports Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions. It is handy to identify performance issues related to disk I/O.

iostat


A good test for iostat is the following command.


iostat -mxty 10 10
This command will run every 10 seconds 10 times.

If the iostat command is unknown in Ubuntu or Debian you can do 

apt install sysstat -y #This will install it for you

Vmstat

vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. The first report produced gives averages since the last reboot.

vmstat

Netstat

The netstat command displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.

netstat

Conclusion

Understanding the basics of these tools and how to use them to monitor your system can provide valuable insights into your system’s performance. Each of these tools has additional options and features to explore, so we recommend looking at their man pages (man ) for more detailed information.

Remember, regular system monitoring is key to maintaining a healthy and stable system. So, get comfortable with these tools, and they will surely serve you well!


Posted

in

,

by

Tags: