List IPv4 filter rules with counters
Build a paste-ready command, then review its compatibility and effects before running it.
iptables -L -n -v --line-numbersread-onlyno known side effects Compatibility
LinuxVerified for Linux using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-20
Requirementsiptablesiptables must be installed and available on PATH.
Version supportiptables Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsChain INPUT (policy DROP 14 packets, 840 bytes)Representative successful output; values vary with the selected target and system state.
Known errorsiptables: command not foundiptables is missing or is not available on PATH.
Verifyiptables -L -n -v --line-numbersThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01iptablesCommandRuns the iptables stage of this one-liner.
02-LOptionConfigures iptables with the -L option.
03-nOptionApplies the command-specific numeric, dry-run, or non-resolving mode.
04-vOptionEnables verbose output for this command.
05--line-numbersOptionConfigures iptables with the --line-numbers option.
Example input
iptables -L -n -v --line-numbers
Example output
Chain INPUT (policy DROP 14 packets, 840 bytes)
num pkts bytes target prot opt in out source destination
1 892 73K ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
Illustrative output — exact values vary by system and data.
Official sources