Loading...

實用的 netstat 查詢連線指令

Temperature: 0 °C

蘇恆永 蘇恆永
author_tools

以下是一些實用的 netstat 語法,可以檢查主機的連線數量:

netstat -na
顯示主機上所有已建立的連線。


netstat -an | grep :80 | sort
顯示所有 port 80 的連線,並把結果排序。


netstat -n -p|grep SYN_REC | wc -l
列出主機上有多少個 SYNC_REC,一般上這個數字應該相當低。


netstat -n -p | grep SYN_REC | sort -u
同樣是列出 SYNC_REC,但不只列出數字,而是將每個 SYNC_REC 的連線列出。


netstat -n -p | grep SYN_REC | awk ‘{print $5}’ | awk -F: ‘{print $1}’
列出發送 SYNC_REC 的所有 ip 地址。


netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
計算每一個 ip 在主機上建立的連線數量。


netstat -anp |grep ‘tcp|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
列出從 TCP 或 UDP 連線到主機的 ip 的數量。


netstat -ntu | grep ESTAB | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -nr
列出每個 ip 建立的 ESTABLISHED 連線數量。


netstat -plan|grep :80|awk {‘print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1
列出每個 ip 建立的 port 80 連線數量。


/misc/log/lighttpd # netstat -anl | grep 80 | awk '/^tcp/ {t[$NF]++}END{for(state in t){print state, t[state]} }'
列出 80 port 各種 tcp 狀態的數量統計


參考來源: http://www.phpini.com/linux/netstat-check-connections

捷運科技大樓站 Go

https://innstory.com/story-實用的_netstat_查詢連線指令-401
Linux 網管

Prev
 Linux_連線數調校

Next
ankhsvn_使用非標準_ssh_port,_及設定免密碼登入 

Nearby Attractions

捷運科技大樓站-Nearby Attractions

  • 原臺灣軍司令官官邸(孫立人將... Go
  • 臺大昆蟲館 Go
  • 黃氏節孝坊 Go
  • 北投臺灣銀行舊宿舍 Go
  • 台灣總督府交通局鐵道部(廳舍... Go
  • 原大阪商船株式會社臺北支店 Go

About the Author

蘇恆永

重新pickup本能中

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

Python TimeUUID

Python TimeUUI...

參考這一篇: 什麼時候讓用 time UUID,https:...

免費電子書下載

免費電子書下載

太晚看到了, 每天都有免費程式設計相關的電子書可以下載 ht...

一堆設計資源, 記錄一下

一堆設計資源, 記錄一下

設計資源總匯 奧革設計 奧革設計團隊精心整理的設計師必備設計資源,收藏各式各樣的靈感、配色、資源、設...

Recommended reading

Other stories happened at this address

vmware 的 vm 網卡如何改成固定 mac

vmware 的 vm 網卡...

http://wahlnetwork.com////rej...

Linux 連線數調校.

Linux 連線數調校.

最近常常遇到連線數太多(因為底層 WebService 太忙了). web 最後連不上的問題. 後來...

ankhsvn 使用非標準 ssh port, 及設定免密碼登入

ankhsvn 使用非標準 ...

ankhsvn https://ankhsvn.open.c...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format