↑ ↓ select, Enter open, Esc close

Delete a ufw rule by number

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
root@server
ufw delete 3

Deletes the rule with the given number after ufw has displayed it and asked for confirmation. Handy for rules with IP addresses or comments that are tedious to retype. Find the number first with ufw status numbered.

Note: After each deletion, the following rules move up. When deleting several rules, always display the list again or work from the highest number downward.

Also searched as

  • ufw delete rule by number
  • remove ufw rule
  • ufw delete numbered rule

Related one-liners

All in Firewall

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.