netstat -l4t | awk ‘{print $4, $6}’ | grep 0.0.0.* | wc -l
thankyou
I have used man ss and find another option
ss -a4 | grep -v “127.0.0” | grep “LISTEN” | wc -l
work for me)
how did you get this?
hi welldone ! thanks but please can you give an explanation on -l4t option, what mean the t option because it’s don’t present with netstat --help
ss -l -4 | grep -v "127.0.0" | grep "LISTEN" | wc -l
ss es mas util actualmente
This works
ss -l4 | grep “LISTEN” | grep -v “127” | wc -l
The problem is poorly worded. The portion in parentheses should read: (IPv4 only, excluding localhost). This would clarify the intent.
I entered my reply before it was complete. Here’s the command line I ran:
netstat -ln4 | grep “LISTEN” | grep -v 127 | wc -l
Hello everyone
After having tryed to find the solution by myself with no result, I decided to try the solutions of this topic, but no luck : none of them worked for me
I am still searching…
Same for me.
netstat -tuln | grep -E “0.0.0.0:[0-9]+”
-
netstat -tuln
: Displays a list of listening TCP and UDP sockets (-t for TCP, -u for UDP, -l for listening, -n for numerical addresses). -
grep -E "0.0.0.0:[0-9]+"
: Filters the output to only include lines that have the IP address “0.0.0.0” (listening on all interfaces) followed by a port number.
Hi gus I found exact answer the answer is 7
ss -tuln4 | grep -v “127.0.0.*” | grep “LISTEN” | wc -l
It is a little bit tricky cuz localhost can have several private ip addresses.
thanku
netstat -l4 | grep -v local | grep LISTEN | wc l
l = LISTENING
4 = IPv4
grep -v local = delete output “local”
grep LISTEN = only output lines that contains LISTEN
wc -l = number of lines
if we make this:
netstat -lt4 | grep -v local | wc -l
t = TCP, only these services can be LISTEN, not UDP. Then we don’t need fliter LISTEN
¡BUT! we must to remember if we don’t filter LISTEN when “wc” count the lines give us two more because first line is “Active Internet connections…” and the second is the name of heach column.
Use this one. This works fine for me:
ss -luntp | grep 0.0.0.0 | grep -v 127.0.0 | grep “LISTEN” | wc -l
grep -v 127.0.0
what does 127.0.0 mean
Hello, I need your help what is 127.0.0 and how did you know about it it is not in the path
this one is showing (Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
rather:- netstat -ln4 | grep LISTEN | grep -v 127 | wc -l this one worked