Basic Usage of the top Command
Let's start by running the top
command in its simplest form. This will give us a real-time, dynamic view of the system's processes.
Open a terminal and run the following command:
top
You should see a display similar to this:
top - 14:30:23 up 5:10, 1 user, load average: 0.15, 0.22, 0.28
Tasks: 213 total, 1 running, 212 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.0 us, 1.3 system, 0.0 ni, 96.3 id, 0.3 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 7824.9 total, 2576.8 free, 2935.0 used, 2313.1 buff/cache
MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4558.1 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1234 user 20 0 3626108 205008 89380 S 2.0 2.6 0:45.85 gnome-shell
5678 user 20 0 859492 51528 38060 S 1.3 0.6 0:10.91 Xorg
9101 user 20 0 722816 36096 29088 S 0.7 0.5 0:05.62 gnome-terminal
This display is continuously updated (by default, every 3 seconds). Let's break down what we're seeing:
- The first line shows the current time, system uptime, number of users, and load average.
- The second line displays the total number of tasks and their states (running, sleeping, stopped, zombie).
- The third line shows CPU usage percentages.
- The fourth and fifth lines display memory and swap usage.
- The table below shows information about individual processes, sorted by CPU usage by default.
To exit top
, press 'q'.