日常运维管理 常用命令(2)

[root@tyzz ~]# w
 23:13:58 up 11 days,  9:15,  1 user,  load average: 0.00, 0.01, 0.05
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0     23:03    6.00s  0.02s  0.00s w
[root@tyzz ~]# uptime 
 23:14:04 up 11 days,  9:15,  1 user,  load average: 0.00, 0.01, 0.05
[root@tyzz ~]# ^C
[root@tyzz ~]#
[root@tyzz ~]# vmstat 1 5
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 105532 124448 436356    0    0     1    23    5   27  0  0 99  0  0
 0  0      0 105524 124448 436356    0    0     0     0  132  286  1  0 99  0  0
 0  0      0 105524 124448 436356    0    0     0     0  126  272  0  0 100  0  0
 4  0      0 102964 124452 436352    0    0     0    28  229  585  3  3 94  0  0
 0  0      0 105276 124452 436356    0    0     0    32  227  528  2  4 94  0  0

si:从交换分区到内存,so:从内存到交换分区;bi:从硬盘到内存,bo:从内存到硬盘;

如果bi,bo值很大 看是什么进程导致io高。 可以用命令 iotop 看看。如果没有这命令,yum install iotop 安装

top 动态查看

free

[root@tyzz ~]# free
             total       used       free     shared    buffers     cached
Mem:       1017992     898652     119340      12632     119056     420752
-/+ buffers/cache:     358844     659148
Swap:            0          0          0
[root@tyzz ~]# free -m
             total       used       free     shared    buffers     cached
Mem:           994        877        116         12        116        410
-/+ buffers/cache:        350        643
Swap:            0          0          0

理解buffer cache

buffer is something that has yet to be "written" to disk.
A cache is something that has been "read" from the disk and stored for later use.

 [root@tyzz ~]# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.3  41096  3160 ?        Ss   Feb14   1:37 /usr/lib/systemd/systemd --system --deserialize 22
root         2  0.0  0.0      0     0 ?        S    Feb14   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Feb14   0:08 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   Feb14   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S    Feb14   0:00 [migration/0]

ps aux | grep xxx 判断xxx进程 是否启动

netstat查看当前系统所有监听端口的命令是(显示数字端口)

netstat -lnp

netstat查看系统所有网络连接状况的命令是(显示数字端口)?

netstat -an

tshark 常用命令

[root@tyzz ~]# tshark -n -t a -R http.request -T fields -e "frame.time" -e "ip.src" -e "http.host" -e "http.request.method" -e "http.request.uri"
tshark: -R without -2 is deprecated. For single-pass filtering use -Y.
Running as user "root" and group "root". This could be dangerous.
Capturing on 'eth0'

"Feb 27, 2017 21:45:55.823973593 CST"    221.11.20.100    119.29.138.182    GET    /
"Feb 27, 2017 21:45:55.873451428 CST"    221.11.20.100    119.29.138.182    GET    /noindex/css/bootstrap.min.css
"Feb 27, 2017 21:45:55.875604880 CST"    221.11.20.100    119.29.138.182    GET    /noindex/css/open-sans.css
"Feb 27, 2017 21:45:56.007230812 CST"    221.11.20.100    119.29.138.182    GET    /images/apache_pb.gif
"Feb 27, 2017 21:45:56.015858512 CST"    221.11.20.100    119.29.138.182    GET    /images/poweredby.png
posted @ 2017-03-25 11:51  aallennty  阅读(307)  评论(0编辑  收藏  举报