Check whether firewalld is currently running.
Do not add, remove, or reload rules.
Which command is appropriate?
firewall-cmd --state reports whether firewalld is running without changing rules.
Detailed explanation
firewall-cmd --reloadIncorrect. --reload reapplies configuration.
Incorrect. --reload reapplies configuration.
firewall-cmd --add-service=httpIncorrect. --add-service changes firewall rules.
Incorrect. --add-service changes firewall rules.
firewall-cmd --remove-service=httpIncorrect. --remove-service changes firewall rules.
Incorrect. --remove-service changes firewall rules.
firewall-cmd --stateCorrect. --state only reports runtime status.
Correct. --state only reports runtime status.
Try it yourself
An example you can run in a temporary verification environment.
firewall-cmd --help 2>&1 | grep -E -- '--state|--reload' | head -n 2Expected result
--stateと--reloadの説明行Key points
- --state
- Read-only status
- Different from reload
Notes
- Environment: firewalld firewall-cmd help / ルール変更なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.