Sie sind auf Seite 1von 7

Understanding the Top command on Linux | Lin...

https://linuxaria.com/howto/understanding-the-t...

Linuxaria

EVERYTHING ABOUT LINUX

Search
Articles

Guides

Interview

Pills

Reviews

Information

Links

sponsored links

Language:

Understanding the Top command on


Linux

Aug

28
2012

Guides
Share
Share

Add comments

Like 0

Tweet

Linuxaria
3,427 likes

top
Article by AlexioBash published
Like Page

on his website about ArchLinux in italian.


Know what is happening in real time on your systems is in my opinion the basis to

Share

Be the first of your friends to like this

use and optimize your OS. On ArchLinux or better on GNU/Linux in general the top
command can help us, this is a very useful system monitor that is really easy to use,
and that can also allows us to understand why our OS suffers and which process
use most resources. The command to be run on the terminal is:

Sponsor

$ top

And well get a screen similar to the one on the right:


Lets see now every single row of this output to explain all the information found
within the screen.

1 Row top

This first line indicates in order:


current time (11:37:19)
uptime of the machine (up 1 day, 1:25)
users sessions logged in (3 users)
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.

Accept

Read

More

1 of 7

11/08/16 09:25

Understanding the Top command on Linux | Lin...

https://linuxaria.com/howto/understanding-the-t...

2 Row task

The second row gives the following information:


Processes running in totals (73 total)
Processes running (2 running)

Follow Me

Processes sleeping (71 sleeping)


Processes stopped (0 stopped)
Processes waiting to be stoppati from the parent process (0 zombie)

Enter email address

3 Row cpu

Subscribe

The third line indicates how the cpu is used. If you sum up all the percentages the
total will be 100% of the cpu. Lets see what these values indicate in order:
Percentage of the CPU for user processes (0.3%us)
Percentage of the CPU for system processes (0.0%sy)
Percentage of the CPU processes with priority upgrade nice (0.0%ni)

Popular posts
Storing large binary files in git

Percentage of the CPU not used (99,4%id)


Percentage of the CPU processes waiting for I/O operations(0.0%wa)

repositories

Percentage of the CPU serving hardware interrupts (0.3% hi Hardware


IRQ

Subscribe by Email

Percentage of the CPU serving software interrupts (0.0% si Software


Interrupts
The amount of CPU stolen from this virtual machine by the hypervisor for

Subscribe to RSS English by mail


Iscriviti agli RSS Italiano via Email

other tasks (such as running another virtual machine) this will be 0 on


desktop and server without Virtual machine. (0.0%st Steal Time)
Recent Comments
ravi on Permanent SSH Tunnels with
autossh

4 and 5 Rows memory usage

FrankK on Symphytum, a Personal


database for Linux
Arnisong on 4 Linux programs to open a
Remote Desktop on Windows
yomm on How to remove Zeitgeist in
Ubuntu and why
Ajtak on How to anonymize the programs

The fourth and fifth rows respectively indicate the use of physical memory (RAM)

from your terminal with torify

and swap. In this order: Total memory in use, free, buffers cached. On this topic you
can also read the following article

My scoop.it feed

Following Rows Processes list

Easy Docker Orchestration With Docker


1.12, AWS EFS And The Swarm Mode
Medium
An Introduction to Iridium, an Open
Source Selenium and Cucumber Testing
Tool - DZone Web Dev
Docker Built-in Orchestration Ready for

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.

Accept

Read

More

2 of 7

11/08/16 09:25

Understanding the Top command on Linux | Lin...

https://linuxaria.com/howto/understanding-the-t...

currently in use. Lets see what information we can get in the different columns:

Consultant
Fluxday: A no-fuss open source
productivity tracker

PID lID of the process(4522)


USER The user that is the owner of the process (root)
PR priority of the process (15)
NI The NICE value of the process (0)
VIRT virtual memory used by the process (132m)
RES physical memory used from the process (14m)
SHR shared memory of the process (3204)
S indicates the status of the process: S=sleep R=running Z=zombie (S)
%CPU This is the percentage of CPU used by this process (0.3)
%MEM This is the percentage of RAM used by the process (0.7)
TIME+ This is the total time of activity of this process (0:17.75)
COMMAND And this is the name of the process (bb_monitor.pl)

Conclusions
Now that we have seen in detail all the information that the command top returns, it
will be easier to understand the reason of excessive load and/or the slowing of the
system.
A good alternative to TOP is HTOP , an evolution of top with features really
amazing.

Popular Posts:
Storing large binary files in git repositories
Share
Share

Like 0

Posted by linuxari at 21:30

Tweet

Tagged with: gnu linux, linux, memory, process, real time,


running processes, sessions, system load average, system
monitor, uptime

12 Responses to Understanding the Top command on Linux

1.

imo says:
Wednesday August 29th, 2012 at 03:56 PM

atop is *way* better and should replace top as a standard


Reply

2.

Frederick Wrigley says:


Wednesday August 29th, 2012 at 05:55 PM

I use top, but more often use htop, which is like top on steriods. Its likely in most
repos for any distro.
Reply

3. Duncan says:
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.

Accept

Read

More

3 of 7

11/08/16 09:25

Understanding the Top command on Linux | Lin...

https://linuxaria.com/howto/understanding-the-t...

OK, so you say what each line means, but at that level, the information is pretty
much there for the reading in the labels or the top manpage, anyway.
The sort of questions I remember asking myself when I first started were things like:
OK, we have Load. I know what average means and I /think/ I know what load
means, and it goes up as the system gets busier, and down as the system is less
busy, but what does 0.02 (the load 1 minute average in the example above)
actually MEAN? It OBVIOUSLY cant be percent CPU load, because thats reported
too, and its WAYY too low for that!
I KNOW its load average, because I can READ the labels. And its easy enough to
find that the three numbers are 1/5/15 minute averages. What I did NOT know was
what load average was.
FWIW, if I understand correctly but not getting /too/ technical. load, on Linux/Unix,
refers the the number of threads that would be ready to run if given CPU time at that
instant, as opposed to those that couldnt run, because theyre waiting for some
event. For instance, as I type this, firefox is spending a lot of time waiting for me to
type the next letter in the textbox, so its mostly idle and not runnable, thus not
contributing to load very much. The instantaneous load can be seen on tops task
line as running (note that at the moment the measurement is taken, top itself is
running, so top should always report at least one running, more if anything else is
running at that instant as well, also note that running actually means runnable,
its quite possible to have a running load well above the actual number of CPU
cores available on your system, so its NOT reporting actually RUNNING, but
runnable, despite the label). For those who like a file interface, its also available
as the procs_running line near the bottom of /proc/stats. Also see /proc/loadavg
for the averages, a runnable/total threads ratio as the 4th number, and I dont know
what the 5th is.
Load average indicates how many threads were runnable on average during the
time in question, and a one-minute load average of 1.00, under ideal conditions,
would mean that exactly one cpu core was running at 100% during the last full
minute, which on a single-core system would be 100% CPU utilization (ideally). Of
course in actuality, a 1.00 one minute load average isnt likely to keep a single CPU
core at 100% usage for the full minute, because for a small fraction of that minute
there was likely a 2.0 instantaneous load as the average was updated and as other
system tasks did their thing, which means there was also a fraction of time when
nothing was ready to run and that core was idle. So to get close to 100% CPU
utilization on a single core in practice takes a bit more, say a 1.5 load average.
And of course on a modern multi-core, the load necessary to fully utilize all cores
goes up along with the number of cores. On my 6-core bulldozer, for instance, a
load average of 6.00 would be the (ideal/theoretical) minimum required to keep the
CPU fully occupied, but in practice, a load average of 9 or so would be more
efficient at it. But get a load average more than about double your number of cores
(and of course for CPUs that have it, theres hyperthreading to figure in as well,
noting that each hyperthread is counted like a physical core would be, tho theres
differences), and your CPU is probably a bottleneck (altho it can be a storage
bottleneck as well, since i/o-wait is counted as load). Additionally, the higher the
load average goes, the more real CPU cycles the kernel takes to manage
scheduling, so while the kernel can /manage/ a load of several hundred per core as
long as memory and other resources dont run out, its spending a lot of time
switching tasks in and out instead of actually doing them, and is therefore going to
take longer in wall-time to complete those tasks, than it would have if load were
limited to say 3 per core. (With tasks like kernel builds, its possible to tell the
system how many jobs to run in parallel. A kernel build is a really nice example
here, as if allowed to schedule unlimited jobs and given enough memory, it can
paralllel several hundred, perhaps over a thousand. I do that here routinely and get
up to about 600, tho it takes my full 16 gig of ram and goes into swap to do so. But
while its fun to watch the runnables climb, even if limited a bit so it doesnt swap
TOO much, letting it schedule say 20 parallel make jobs per core, 120 jobs total on
my 6-core, does take longer in wall time to complete than something more

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.

Accept

Read

More

4 of 7

11/08/16 09:25

Understanding the Top command on Linux | Lin...

https://linuxaria.com/howto/understanding-the-t...

numbers are, and can make better guesses about the tasks line (tho the zombie
entry needs more explanation). But what about the rest? The title of the article
suggests the reader will /understand/ top when hes done reading it. Hardly! If they
can read labels (and if they couldnt, how could they read this article) and had run
the command before, they barely know more about it whan when they started, let
alone UNDERSTAND it. Now the article needs to be expanded to do pretty much
what I did for load, to nearly every single entry (the uptime, etc, seems pretty self
explanatory). What does user vs system vs nice vs wait vs actually MEAN, for
instance. Whats do nice and priority mean in the Linux scheduling context, and how
do they relate to each other? If the memory line says I have 0 free memory, does
that mean the systems about to crash? (Hint: No, the free in free memory
doesnt mean what one might intuitively /think/ it means, in this context.) We have
the names and the numbers, now we just need to UNDERSTAND them, something
the article title and opening blurb suggest the article will help with, but which it
unfortunately did a rather poor job at. Wheres the understand part? =:^(
Reply

Mike says:
Saturday August 22nd, 2015 at 02:59 AM

Thank you for making this article actually worth reading. I was very
frustrated in the uselessness of it until I got to your comment.
Reply

Steve says:
Friday January 1st, 2016 at 01:11 AM

Thanks, I learned stuff.


Interesting that the author has responded to other comments but not this
one
Reply

4.

woo says:
Thursday August 30th, 2012 at 02:50 PM

there are some lines in Italian that slipped through untranslated:


%CPU indica la percentuale del processo sul carico sulla cpu (0.3)
%MEM indica la percentuale del processo sul carico della RAM (0.7)
TIME+ indica il tempo di attivit del processo (0:17.75)
COMMAND indica il nome del processo (bb_monitor.pl)
I _do_ understand them

but for the sake of consistency, please translate those


Reply

linuxari says:
Thursday August 30th, 2012 at 03:25 PM

Thanks Woo.
Fixed
Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.

Accept

Read

More

5 of 7

11/08/16 09:25

Understanding the Top command on Linux | Lin...

https://linuxaria.com/howto/understanding-the-t...

thanks for your explanations, but which is better htop or top


Reply

linuxari says:
Sunday December 2nd, 2012 at 07:55 PM

You can find top in every Linux system, while you have to install htop
that IMO give much more information
Reply

6.

euro-space.net says:
Saturday March 29th, 2014 at 04:40 PM

Useful article, helping diagnose server load problems. Using with atop is much
recommended.
Reply

7.

Kenny says:
Monday October 13th, 2014 at 01:56 PM

Thank you.
Reply

8.

PC says:
Wednesday November 19th, 2014 at 12:41 AM

Thank you..
Reply

Leave a Reply
Your Comment

You may use these HTML tags and attributes: <a href="" title=""> <abbr
title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code>
<del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Name

(required)

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.

Accept

Read

More

6 of 7

11/08/16 09:25

Understanding the Top command on Linux | Lin...

https://linuxaria.com/howto/understanding-the-t...

URI

CAPTCHA Code

Submit Comment

Cacti Makes Device


Monitoring Simple

2013 Linuxaria

How to install NSD Instead of BIND as name server on


Linux to save Memory

All site content, except where otherwise noted, is licensed


under a Creative Commons Attribution-ShareAlike 3.0

Suffusion theme by Sayontan Sinha

Unported License.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.

Accept

Read

More

7 of 7

11/08/16 09:25

Das könnte Ihnen auch gefallen