03. Dynamically Viewing Processes top

To see process information in real time, use the top command. top is a text-based program that shows all processes running and updates every few seconds so you can monitor them in real-time.

command line ps aux gif

The view is separated into two halves - the top half is the system summary, while the bottom half is a table of processes sorted by the CPU activity. top is sorted by CPU usage by default.

The system summary

Let's break down just the top half part of top.

$ top
top - 23:07:07 up 13 min, 2 users, load average: 0.02, 0.14, 0.14 Tasks: 160 total, 3 running, 157 sleeping, 0 stopped, 0 zombie %Cpu(s): 31.7 us, 8.9 sy, 0.0 ni, 59.1 id, 0.4 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem: 501496 total, 495492 used, 6004 free, 2568 buffers KiB Swap: 522236 total, 289316 used, 232920 free. 83052 cached Mem

First row, top:

up - The amount of time since the machine was last booted.
users - Number of users logged in.
load average - Number of processes that are waiting their turn at the CPU in the last 1, 5 and 15 minutes. Any values < 1.0 means machine is not busy.
Number of processes and their various process states.
The task's share of the CPU time since the last screen update.
us is the CPU being used for user processes. Processes outside the kernel itself.
sy is how much is used for system processes (kernal).
ni is how much is used by nice processes.
id is the amount of CPU that is idle.
wa is percentage waiting for I/O.
How much physical RAM is being used.
How much swap space is being used.

Checking system load average

Another way you can check load average without going through top is with the uptime command. You can use this command to quickly check if you have a runaway process that may have hung.

Key Commands

You can access the help screen with the h key or ?. To quit, press q. Here are some other commands you may use:

Kill a process by inputting PID number.
Change a processe's priority. Positive value decrease priority while a negative value increases. Default is 0 to begin with, and ranges are from -20 to 20.
Display update rate (seconds).
Sets display to sort by CPU usage.
Change the display to sort by memory usage.


top, like many other commands, come with several options.

-d delay
Delay between updates - default is 5 seconds.
-p pid
Monitor specific processes.
-n iter
Tell top to display a certain number of updates, and then quit.
Batch mode.

Take your Linux skills to the next level!

Linux for Beginners

Take your Linux skills to the next level! Try Linux & UNIX

Linux for Beginners doesn't make any assumptions about your background or knowledge of Linux. You need no prior knowledge to benefit from this book. You will be guided step by step using a logical and systematic approach. As new concepts, commands, or jargon are encountered they are explained in plain language, making it easy for anyone to understand.

$ Check price
24.9924.99Amazon 4.5 logo(101+ reviews)

More Linux & UNIX resources

Aching back from coding all day?

Prism Glasses

Aching back from coding all day? Try Back Problems

Ever feel achy from sitting crunched up on your computer table? Try lying down with these optical glasses that allow you to work on your laptop while lying flat on your back. This is the perfect solution with those with limited mobility or those who wish to prevent neck cramps and back strains.

$ Check price
4.454.45Amazon 4 logo(128+ reviews)

More Back Problems resources