Check the Linux native open port with one command

October 3, 2016 23514 point heat 2 people like 1 comment

View listening IPV4 ports only

 netstat -lnt | awk 'NR>2{print $4}' | grep -E '0.0.0.0:' | sed 's/.*://' | sort -n | uniq

View only listening ipv6 ports

 netstat -lnt | awk 'NR>2{print $4}' | grep -E ':::' | sed 's/.*://' | sort -n | uniq

Both ipv4 and ipv6

 netstat -lnt | awk 'NR>2{print $4}' | grep -E '(0.0.0.0:|:::)' | sed 's/.*://' | sort -n | uniq

If you want to list all ports listening on the localhost interface, use the following:

 netstat -lnt | awk 'NR>2{print $4}' | grep -E '(127.0.0.1:|::1:)' | sed 's/.*://' | sort -n | uniq

Gcod

If life is just like the first sight, what is the sad autumn wind painting fan

Article comments

  • mortgages first

    mortgage services of texas mortgage services mortgage services of texas mortgage servicing

    June 18, 2018