Validate an nftables file without applying it
Build a paste-ready command, then review its compatibility and effects before running it.
nft --check --file /etc/nftables.confread-onlyno known side effects Compatibility
LinuxVerified for Linux using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-20
Requirementsnftnft must be installed and available on PATH.
Version supportnft Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signals(no output; exit status 0 confirms valid nftables syntax)Representative successful output; values vary with the selected target and system state.
Known errorsnft: command not foundnft is missing or is not available on PATH.
Verifynft --check --file /etc/nftables.confThe 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
01nftCommandRuns the nft stage of this one-liner.
02--checkOptionRuns validation or simulation mode without applying changes.
03--fileOptionConfigures nft with the --file option.
04/etc/nftables.confArgumentPasses /etc/nftables.conf to nft.
Example input
nft --check --file /etc/nftables.conf
Example output
(no output; exit status 0 confirms valid nftables syntax)
Illustrative output — exact values vary by system and data.
Official sources