Hi all
Someone in my office is asking how does the "top" command works in linux. They have googled and found nothing.
Can any linux fundus comment on this?
Thanks
T
Printable View
Hi all
Someone in my office is asking how does the "top" command works in linux. They have googled and found nothing.
Can any linux fundus comment on this?
Thanks
T
It reads the /proc data
Ok, how does someone use that command, would you mind giving me an example for the newbie :P
Cider,
Pretty self explanatory.
To run it, you simply type 'top' at the command shell and it will give you a real time snapshot of your processes, cpu and vm stats. It does this by reading the data that gets logged to /proc. There are also other related commands.
type 'man top' for an explanation of the fields as well as related commands.
If I knew what your colleague was trying to accomplish, perhaps I could provide more precise suggestions.
Quote:
Processes: 57 total, 3 running, 2 stuck, 52 sleeping... 249 threads 09:11:03
Load Avg: 0.12, 0.18, 0.17 CPU usage: 5.96% user, 8.72% sys, 85.32% idle
SharedLibs: num = 8, resident = 80M code, 1612K data, 5068K linkedit.
MemRegions: num = 7894, resident = 341M + 20M private, 210M shared.
PhysMem: 326M wired, 667M active, 116M inactive, 1118M used, 930M free.
VM: 8859M + 371M 53053(0) pageins, 0(0) pageouts
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
445 top 8.0% 0:00.85 1 18 29 828K 200K 1420K 18M
434 bash 0.0% 0:00.01 1 14 19 296K 184K 936K 18M
433 login 0.0% 0:00.10 1 17 55 332K 188K 1112K 19M
432 Terminal 3.5% 0:01.85 3 103- 158 2388K+ 19M 9100K+ 363M
428 mdworker 0.1% 0:00.38 4 71 38 780K 5468K 2372K 31M
398 Preview 0.0% 0:04.32 3 101 199 5312K 20M 14M 383M
387 Microsoft 1.1% 0:23.90 12 179+ 694 89M+ 46M 141M+ 571M+
266 AppleSpell 0.0% 0:01.47 1 37 30 584K 7908K 4200K 34M
148 Alerts Dae 0.0% 0:00.85 2 65 132 2328K 10M 5020K 329M
145 Safari 6.2% 8:54.09 14 270 1007 76M 26M 115M 487M
137 Microsoft 0.0% 0:00.08 1 60 41 416K 408K 2312K 291M
134 Microsoft 1.0% 3:40.00 16 218+ 671 37M+ 41M 82M+ 470M+
133 Adium 0.0% 0:28.59 10 187 576 14M 29M 33M 418M
132 SpeechReco 0.0% 0:31.18 2 136 131 7476K 4044K 8760K 336M
131 SpeakableI 0.0% 0:40.02 1 123 129 1600K 10M 4960K 342M
129 SpeechFeed 0.0% 0:08.40 2 135 140 2480K 11M 6040K 330M
126 SpeechSynt 0.0% 0:00.08 1 75 44 472K 6816K 2416K 290M
125 Microsoft 0.0% 0:09.14 2 91 155 4464K 12M 11M 349M
117 Finder 0.0% 0:04.50 7 161+ 243 5316K+ 21M 16M+ 373M+
116 SystemUISe 0.2% 0:12.23 7 226 288 3792K 12M 9504K 353M
115 coreaudiod 0.0% 0:07.52 2 113 72 3656K 1264K 4692K 23M
113 pboard 0.0% 0:00.00 1 15 23 168K 184K 588K 19M
111 ATSServer 0.0% 0:03.44 2 109 139 1232K 7072K 5724K 71M
110 Dock 0.0% 0:02.75 3 125 239 3420K 12M 10M 342M
109 UserEventA 0.0% 0:00.36 2 121 81 700K 1760K 2168K 20M
108 Spotlight 0.0% 0:00.22 2 80 75 1104K 8180K 4068K 292M
104 AirPort Ba 0.0% 0:00.09 3 79 93 660K 8460K 3008K 323M
He should be able to 'man top' and if it's a recent distribution of linux, he even might have htop which is a lot more streamlined, both of which you run at the command line as already mentioned.