WindowsMacSoftwareSettingsSecurityProductivityLinuxAndroidPerformanceConfigurationApple All

How to Monitor System Resources in Ubuntu

Edited 3 weeks ago by ExtremeHow Editorial Team

System ResourcesMonitoringUbuntuToolsLinuxPerformanceOperating SystemsDesktopAdministrationSystem

How to Monitor System Resources in Ubuntu

This content is available in 7 different language

Monitoring system resources is important for understanding how well your computer is running. It can help you identify processes that are using more resources than necessary and also help diagnose various problems. In this document, we will explore various ways to monitor system resources on Ubuntu. We assume that you have a basic understanding of Ubuntu and can execute commands in the terminal. Monitoring system resources includes checking CPU, memory, disk usage, and network activity.

Using system monitor

The easiest way to monitor system resources in Ubuntu is to use the System Monitor application. It provides a GUI to view your system's resource usage. To access it, follow these steps:

  1. Open the Activities overview screen by pressing the Super key (Windows key on many keyboards).
  2. Type system monitor and open the application displayed.

Once opened, you will find three tabs:

Monitoring CPU usage

There are various ways to monitor CPU usage on Ubuntu, from graphical applications to command-line tools.

Using the top command

top command provides a dynamic real-time view of what is happening in your system. To use it, open the terminal and type:

top

This command lists the processes with the highest CPU usage at the top. The main sections include:

To exit, press q.

Using the htop command

htop command is similar to top, but it provides a more intuitive and better interface. First, you need to install it by running:

sudo apt install htop

After installation, type htop in the terminal to start it. It displays CPU usage, along with memory and swap usage in colorful graphs, making it easy to understand. You can navigate using the arrow keys and end processes directly by pressing F9.

Monitoring memory usage

Memory usage can be checked through graphical applications such as System Monitor or command-line utilities.

Using the free command

The free command shows the amount of free and used memory on your system. In the terminal, type:

free -h

-h option makes the output human-readable, and displays the size in GB or MB.

Using the vmstat command

vmstat command provides a snapshot of memory usage, among other things. Run it by typing:

vmstat

This command outputs information about processes, memory, paging, block IO, traps, and CPU activity. It provides a comprehensive overview of system performance compared to free.

Monitoring disk usage

Your data is stored on disk, and keeping an eye on its usage helps prevent unexpected space shortages.

Using the df command

df command reports file system disk space usage. Use it by typing:

df -h

-h flag makes the output human-readable. This command shows the amount of used and available disk space on a Linux file system.

Using the du command

du command estimates file space usage. This is helpful for finding out which files or directories are taking up the most space:

du -sh /path/to/directory

This will give you a summary of the disk usage of the specified directory.

Monitoring network usage

To understand network activity, various tools can provide information about your bandwidth usage.

Using the iftop command

The iftop command is used to display bandwidth usage on an interface by a host. Install it using the following:

sudo apt install iftop

Once installed, run it by typing the following:

sudo iftop

This command requires root privileges, hence sudo prefix. iftop command displays active network connections, which shows who is using your bandwidth.

Using the nload command

nload is another command-line utility that provides a graphical representation of network usage over time. Install it using the following:

sudo apt install nload

Then, run nload to start monitoring network traffic. This shows the incoming and outgoing traffic for each network interface separately.

Conclusion

Monitoring system resources in Ubuntu can be done through a variety of tools, ranging from graphical interfaces like System Monitor to command-line utilities like top, htop, free, df, du, iftop, and nload. Each tool has its place in providing information about system performance and resource allocation. Depending on your comfort level with the command-line or graphical interface, you can choose different methods. Regular monitoring can help maintain system health and performance, catch resource hogs early, and plan effectively for future upgrades.

If you find anything wrong with the article content, you can


Comments