Linux命令记事本

2017-05-31  本文已影响0人  Chenzongshu

tcpdump

tcpdump tcp -i eth1 -t -s 0 -c 100 and dst port ! 22 and src net 192.168.1.0/24 -w ./target.cap

(1)tcp: ip icmp arp rarp 和 tcp、udp、icmp这些选项等都要放到第一个参数的位置,用来过滤数据报的类型
(2)-i eth1 : 只抓经过接口eth1的包, -i any表示抓所有接口的
(3)-t : 不显示时间戳
(4)-s 0 : 抓取数据包时默认抓取长度为68字节。加上-S 0 后可以抓到完整的数据包
(5)-c 100 : 只抓取100个数据包
(6)dst port ! 22 : 不抓取目标端口是22的数据包
(7)src net 192.168.1.0/24 : 数据包的源网络地址为192.168.1.0/24
(8)-w ./target.cap : 保存成cap文件,方便用ethereal(即wireshark)分析

抓取某个host发过来和发给它的数据包:

tcpdump -i eth0 'src host 192.168.202.228' or 'dst host 192.168.202.228'

查看某个服务的日志

journalctl -xe -u docker-latest > /tmp/log.out #如docker-latest服务

查看系统负载

vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 496056 889316 4065748    0    0     9    41   55   51  0  0 99  1  0
上一篇 下一篇

猜你喜欢

热点阅读