- 论坛徽章:
- 0
|
top命令返回如下:
[root@management ~]# top -b -n 2
top - 13:13:02 up 4:17, 1 user, load average: 0.15, 0.05, 0.01
Tasks: 120 total, 1 running, 119 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.1%us, 0.2%sy, 0.0%ni, 97.6%id, 0.9%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 3925152k total, 3587764k used, 337388k free, 160976k buffers
Swap: 10207224k total, 0k used, 10207224k free, 478228k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
11870 root 20 0 15084 1100 832 R 1.8 0.0 0:00.07 top
1 root 20 0 19396 1564 1256 S 0.0 0.0 0:01.07 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.45 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
7 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
9 root 20 0 0 0 0 S 0.0 0.0 0:00.16 ksoftirqd/1
10 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 events/0
12 root 20 0 0 0 0 S 0.0 0.0 0:00.03 events/1
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuset
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper
15 root 20 0 0 0 0 S 0.0 0.0 0:00.01 netns
16 root 20 0 0 0 0 S 0.0 0.0 0:00.00 async/mgr
17 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pm
18 root 20 0 0 0 0 S 0.0 0.0 0:00.00 sync_supers
19 root 20 0 0 0 0 S 0.0 0.0 0:00.00 bdi-default
20 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kintegrityd/0
21 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kintegrityd/1
现在想使用命令行获取内存和cpu的信息,需要的结果如下:
%CPU %MEM
1.8 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
求高手指点,谢谢! |
|