How to check specific port status of ufw in shell script?

I want to check the status of a specific port of ufw in shell script.

To check the status I wrote like this.

ufw status | grep -c "^443\s\+ALLOW"

It works now for my usage, but if possible I want to use more stable way. Is there a better way to check the port status of ufw?

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like