mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 03:23:05 +00:00
26 lines
567 B
Text
26 lines
567 B
Text
% network
|
|
|
|
# Kill a process running on a given port
|
|
lsof -i :<port> \
|
|
| awk '{l=$2} END {print l}' \
|
|
| xargs kill
|
|
|
|
# List IP addresses connected on a given port
|
|
netstat -tn 2>/dev/null \
|
|
| grep :<port> \
|
|
| awk '{print $5}' \
|
|
| cut -d: -f1 \
|
|
| sort \
|
|
| uniq -c \
|
|
| sort -nr \
|
|
| head
|
|
|
|
# Find external, public IP address
|
|
dig +short myip.opendns.com @resolver1.opendns.com
|
|
|
|
# Find primary, local IP address
|
|
ifconfig \
|
|
| grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' \
|
|
| grep -Eo '([0-9]*\.){3}[0-9]*' \
|
|
| grep -v '127.0.0.1' \
|
|
| tail -n1
|