Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
let’s simple check for ssh-port 22
this is the part of code used – then it looks if there is at least ONE line
netstat -an | grep LISTEN | grep 22
result: *.22 *.* 0 0 49152 0 LISTEN *.22 *.* 0 0 49152 0 LISTEN *.11221 *.* 0 0 49152 0 LISTEN *.11222 *.* 0 0 49152 0 LISTEN *.22 *.* 0 0 49152 0 LISTEN
(you get any line containing “22” not only where the PORT is 22!!