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?

Your Answer

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

Browse other questions tagged or ask your own question.