3 Ubuntu Commands for Monitoring System Resource Use

Three basic commands can help you monitor system resource use in Ubuntu and other Linux distributions. Learn about the DF, Top, and Free commands.

Brien Posey

August 29, 2022

4 Min Read
3 Ubuntu Commands for Monitoring System Resource Use
Getty Images

A big part of maintaining a healthy Ubuntu machine is ensuring it has the right amount of system resources available. System resources should sufficiently accommodate any workload that may run on the machine, as well as meet the needs of the OS itself.

Fortunately, there are three simple Ubuntu commands you can use to monitor hardware use.

Monitoring Disk Space: The DF Command

The first command to know is the DF command.

DF stands for “Disk Free.” As the name implies, the DF command is used to find out how much free disk space is available.

If you come from a Windows background, you will find that the DF command works a little bit differently than the Get-ChildItem cmdlet or DIR command. Those commands display the current volume’s contents and the amount of remaining disk space.

By contrast, when you enter the DF command, Ubuntu will display a list of file systems present on the system, as well as the total size and amount of free space available within each file system.

As a best practice, you should append the -H switch when using the DF command. The -H switch tells Ubuntu to put the results into a human-readable format. The output will be shown in megabytes and gigabytes as opposed to bytes. You can see what this command looks like in Figure 1.

Related:How To Create Ubuntu Virtual Machines the Easy Way

Ubuntu screenshot of DF command shows data about filesystem, size, used, available, used percentage, and mounted on

Linux Resources 1

Figure 1. The DF command shows the disk’s contents.

Monitoring Processes: The Top Command

Windows systems use numerous background processes to perform low-level tasks within the operating system. There are also processes associated with any applications that you might choose to run. You can view these processes through the Windows Task Manager or by using the Get-Process cmdlet within PowerShell.

The concept of processes is not unique to Windows. Ubuntu and other Linux systems also make use of processes. As in the case of Windows systems, some of these processes make extremely light use of the available hardware resources, while others tend to be far more demanding.

You can see the processes that are running on an Ubuntu machine by entering the Top command. After you enter this command, Linux will present a summary of the total number of tasks that are running on the system. Linux will also give you a breakdown of the individual processes. This not only includes the amount of CPU and memory resources used by each process, but also the user who launched the process, the process ID, and the command that is tied to the process. 

Ubuntu screenshot shows Top command and resulting data about processes that are running

Linux Resources 2

Figure 2. The Top command provides information about the processes that are running on the system.

If you try the command on your own system, the Top data will be continuously displayed until you press Ctrl+C.

Incidentally, the screen capture shown in Figure 2 was taken from a command line-only Ubuntu shell running on the Windows Services for Linux. The reason why most Linux deployments are command line only is because the GUI consumes a significant amount of system resources.

To see just how much of a difference this makes, see Figure 3, which shows the results of running the Top command on an Ubuntu machine that has the Linux desktop installed.

Screenshot shows information produced by Top command

Linux Resources 3

Figure 3. The GUI consumes significant system resources.

Monitoring Memory Use: The Free Command

Finally, just as the Top command will show the processes running on your system, the Free command will show how the system’s memory is used.

Entering Free at the command prompt causes Ubuntu to display the system’s total memory, how much memory is in use, and how much memory is free. You can also get information about swap memory by using the Free command.

Ubuntu screenshot shows information produced by Free command

Linux Resources 4

Figure 4. The Free command shows how the system is using the available memory.

About the Author(s)

Brien Posey

Brien Posey is a bestselling technology author, a speaker, and a 20X Microsoft MVP. In addition to his ongoing work in IT, Posey has spent the last several years training as a commercial astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space.


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like