How to calculate TCP connection infomation without ss and netstat
sort by remote port
array=($(tail -n +2 /proc/net/tcp | cut -d":" -f"4"|cut -d" " -f"1"))
for port in ${array[@]}; do echo $((0x$port)); done | sort | uniq -c
sort by local port
array=($(tail -n +2 /proc/net/tcp | cut -d":" -f"3"|cut -d" " -f"1"))
for port in ${array[@]}; do echo $((0x$port)); done | sort | uniq -c
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.me
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No privacy information is collected here
Try iOS App