linux備忘__linux

來源:互聯網
上載者:User
xargs
// 根據關鍵字kill進程ps -ef | grep keyword | awk '{print $2}' | xargs kill -9
watch
// 根據watch命令即時監控redis值watch -n 0.2 'redis-cli -h 127.0.0.1 -p 6379 -a password llen list_key'
netstat
/** * -a, --all, --listening     display all sockets (default: connected) * -e, --extend               display other/more information * -p, --programs             display PID/Program name for sockets * -n, --numeric              don't resolve names */// 查看linux下面所有tcp串連狀態以及數量netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'// 根據關鍵字查看tcp串連資訊netstat -anep | grep -E "key1.*key2"
grep
// 或操作,加 -E 參數grep -E "key1|key2"// 或操作,使用egrep擴充匹配egrep "key1|key2"// 或操作,匹配詞裡面加反斜線 \ ,開始開啟egrep擴充正則匹配grep "key1\|key2"// 與操作,同或操作grep "key1.*key2"grep -E "key1.*key2"egrep "key1.*key2"
tcpdump
/** * 監聽資料包 *    host 指定IP接收和發送的包 *    port 當前主機80連接埠接收和發送的包 *    src 指定來源 *    dst 指定目標 *    -i 指定網卡 *    -nn 以數字形式顯示連接埠號碼 *    -A 以ascii的方式顯示資料包 *    -X 以16進位和ascii的方式顯示資料包 *    -S 將tcp的序號以絕對值形式輸出,而不是相對值 *    -vv 輸出詳細的報文資訊 */// 擷取ip與當前主機80連接埠通訊的包,並且以ascii展示# tcpdump -i eth1 -nnA  host xxx.xxx.xxx.xxx and tcp port 80// 擷取ip與當前主機80連接埠通訊的包,以16進位和ascii展示,顯示序號絕對值# tcpdump -i eth1 -XSnnvv host xxx.xxx.xxx.xxx and port 80// 擷取ip發送到本機80連接埠的包# tcpdump -i eth1 -nnA src host xxx.xxx.xxx.xxx and tcp port 80// 擷取本地80連接埠發送到ip的包,並且以16進位和ascii展示# tcpdump -i eth1 -nnX dst host xxx.xxx.xxx.xxx and tcp port 80
ifconfig
// 查看本機所有網卡# ifconfig -a
sysctl ulimit iftop
// 即時監控系統流量# iftop

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.