1. uptime 显示当前时间,系统运行了多长时间,当前有多少用户登录,过去1、5、15分钟的系统负载平均值。
输入命令:$uptime -p
结果: up 1 day, 28 minutes
输入命令:$uptime
结果: 10:43:46 up 1 day, 29 min, 1 user, load average: 1.09, 1.03, 1.01
2. 打印内核缓冲区信息
输入命令: $ dmesg | tail
[30149.400886] ffs_data_put(): freeing
[30149.420744] read descriptors
[30149.420840] read strings
[30150.706516] dwc3 fcc00000.dwc3: device reset
[30150.706729] android_work: did not send uevent (0 0 (null))
[30150.766498] android_work: sent uevent USB_STATE=CONNECTED
3. 报告有关进程、内存、分页、块的信息,IO、中断、磁盘和 CPU 活动。
输入命令: $ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 1827640 4592 132672 0 0 0 0 102 93 0 1 99 0 0
4. 报告处理器相关的统计数据,输入命令: $mpstat -P ALL 1
Linux 4.4.0-210-generic (ubuntu) 12/02/2022 _x86_64_ (4 CPU)
10:48:14 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
10:48:15 AM all 0.00 0.00 0.25 0.50 0.00 0.00 0.00 0.00 0.00 99.25
10:48:15 AM 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
10:48:15 AM 1 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 99.00
10:48:15 AM 2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
10:48:15 AM 3 0.00 0.00 0.00 1.01 0.00 0.00 0.00 0.00 0.00 98.99
5.查看进程,输入命令: $pidstat 1
Linux 4.4.0-210-generic (ubuntu) 12/02/2022 _x86_64_ (4 CPU)
10:49:40 AM UID PID %usr %system %guest %CPU CPU Command
10:49:41 AM 0 1270 0.00 1.98 0.00 1.98 0 Xorg
10:49:41 AM 1000 2911 0.00 0.99 0.00 0.99 1 compiz
10:49:41 AM 1000 11138 0.00 1.98 0.00 1.98 1 pidstat
6.查看硬盘输入输出,输入命令: $iostat -xz 1
Linux 4.4.0-210-generic (ubuntu) 12/02/2022 _x86_64_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.10 0.00 0.14 0.09 0.00 99.67
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
loop0 0.00 0.00 0.00 0.00 0.00 0.00 3.20 0.00 4.80 4.80 0.00 4.80 0.00
sda 0.02 0.15 0.91 0.08 16.01 9.46 51.48 0.03 34.13 14.34 252.00
7.输入命令:$free -mh
total used free shared buff/cache available
Mem: 3.6G 949M 942M 30M 1.7G 2.2G
Swap: 1.0G 0B 1.0G
8.收集、报告或保存系统网络信息。
输入命令:$sar -n DEV 1
Linux 4.4.0-210-generic (ubuntu) 12/02/2022 _x86_64_ (4 CPU)
10:52:38 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
10:52:39 AM ens33 8.00 0.00 0.62 0.00 0.00 0.00 0.00 0.00
10:52:39 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
9.输入命令:$sar -n TCP,ETCP 1
Linux 4.4.0-210-generic (ubuntu) 12/02/2022 _x86_64_ (4 CPU)
10:53:08 AM active/s passive/s iseg/s oseg/s
10:53:09 AM 0.00 0.00 0.00 0.00
10:53:08 AM atmptf/s estres/s retrans/s isegerr/s orsts/s
10:53:09 AM 0.00 0.00 0.00 0.00 0.00
10:53:09 AM active/s passive/s iseg/s oseg/s
10:53:10 AM 0.00 0.00 0.00 0.00
10:53:09 AM atmptf/s estres/s retrans/s isegerr/s orsts/s
10:53:10 AM 0.00 0.00 0.00 0.00 0.00
10.输入命令:$ top
top - 10:53:49 up 1 day, 1:12, 1 user, load average: 0.00, 0.07, 0.04
Tasks: 266 total, 1 running, 265 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.1 us, 0.1 sy, 0.0 ni, 99.7 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 3754232 total, 964640 free, 972564 used, 1817028 buff/cache
KiB Swap: 1046524 total, 1046524 free, 0 used. 2331200 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1270 root 20 0 430952 104524 50956 S 6.7 2.8 3:31.85 Xorg
11154 xxxxxx 20 0 41928 3784 3072 R 6.7 0.1 0:00.01 top
1 root 20 0 185200 5636 3820 S 0.0 0.2 0:05.10 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.04 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:01.01 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
联系客服