Im setting up a web server on 18.04 and I want to be able to block all ip's except my public ip from accessing ssh (22) on the UFW. Thanks for your help!
This should do the trick assuming your public ip is
sudo ufw allow from 220.127.116.11/32 to any port 22
Please refer to
man ufw for more info.
I hope this helps.