iptables-save Command: Linux Usage Guide

The iptables-save command in Linux is used to save the current iptables rules and output them to standard output or a specified file. The basic syntax of using this command is as follows:

iptables-save [OPTIONS] > filename

Among them, OPTIONS is an optional parameter that can be added as needed. If no options are specified, the rules will be output to the standard output by default. If you want to save the rules to a file, you can use the redirect symbol “>” to redirect the output results to the specified file.

For example, saving the current iptables rules to a file:

iptables-save > /etc/iptables/rules.v4

This will save the current iptables rules to the /etc/iptables/rules.v4 file.

bannerAds