How do you use top command with an example?

The top command in Linux is a powerful tool that provides a real-time view of the system's resource usage, including CPU, memory, and process information. It helps administrators monitor system performance and pinpoint issues effectively.

To use the top command, simply open your terminal and type:

top

Once executed, you'll see a dynamic display similar to this:

Tasks: 207 total, 1 running, 206 sleeping, 0 stopped, 0 zombie %Cpu(s): 5.7 us, 2.5 sy, 0.0 ni, 91.6 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 7989.2 total, 1718.1 free, 4565.8 used, 1705.3 buff/cache MiB Swap: 2048.0 total, 1774.3 free, 273.7 used. 2981.6 avail Mem

In this display:

  • Tasks: Information about processes and their states.
  • %Cpu(s): Shows CPU utilization percentages.
  • MiB Mem: Displays memory usage, including total, free, used, and cache memory.
  • MiB Swap: Provides information about swap memory usage.

Press q to exit the top command interface.


Linux top command system monitoring process management real-time system usage