So, I’m using netstat -lt to get open ports. However, I’m not interested in certain values (like SSH or 22), so I want to be able to exclude them. I also want to get them as an array in bash. So far I have netstat -lt | sed -r 's/tcp[^:]+://g' | cut -d' ' -f1 but they’re not an array, nor am I excluding anything.
So, I’m using netstat -lt to get open ports. However, I’m not interested in
Share
Add
($())around your statement:Filtering ports 22 and 25.