Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # listen_tcp_ports_lsof.sh
- for port in $(ss -ltn | tail -n $[$(ss -ltn | wc -l)-1] | awk '{print $4}'| sed -e 's/^.*://' | sort -n)
- do
- (lsof -i:$port | grep LISTEN) | while read line
- do
- echo "$port $line"
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement