• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

“-bash: firewall: command not found” – How to resolve in CentOS/RHEL 7

by admin

The Problem

Why is the below error observed when the firewall-cmd –state command is executed:

-bash: firewall: command not found

The Solution

If there is a syntax error while executing the command, one may get the error of the following sorts :-

# firewall-cmd -state
usage: see firewall-cmd man page
firewall-cmd: error: unrecognized arguments: -state
# firewall -cmd --state
-bash: firewall: command not found

stop firewalld in CentOS/RHEL 7

The below command may be executed to stop firewall:

# systemctl stop firewalld

For Example:

# systemctl status firewalld

firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
   Active: active (running) since Thu 2015-03-12 09:31:07 IST; 5h 33min ago
 Main PID: 814 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─814 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Mar 12 09:31:06 rhel7-server systemd[1]: Starting firewalld - dynamic firewall daemon...
Mar 12 09:31:07 rhel7-server systemd[1]: Started firewalld - dynamic firewall daemon.
# firewall-cmd --state
running
# systemctl stop firewalld
# firewall-cmd --state
not running

disable firewalld in CentOS/RHEL 7

Below command may be execute to disable service (Turn the service off for the next reboot, or any other trigger.)

# systemctl disable firewalld.service

For example:

# systemctl disable firewalld.service
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'

enable firewalld in CentOS/RHEL 7

To re enable the firewalld service again, use the below command:

# systemctl enable firewalld.service

For example:

# systemctl enable firewalld.service
ln -s '/usr/lib/systemd/system/firewalld.service' '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
ln -s '/usr/lib/systemd/system/firewalld.service' '/etc/systemd/system/basic.target.wants/firewalld.service'

Verify if firewalld is enabled or disabled in CentOS/RHEL 7

# systemctl is-enabled firewalld
disabled
# systemctl is-enabled firewalld
enabled
Firewalld Command line Reference (Cheat Sheet)
CentOS / RHEL 7 : Beginners guide to firewalld

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. Linux OS service ‘iscsid’
  2. How to enable IPv6 on CentOS / RHEL 7
  3. How to schedule Jobs with Cron in Linux
  4. firewall-offline-cmd Command Examples in Linux
  5. How To Configure SNMP Daemons: snmpd and snmptrapd on CentOS/RHEL 5,6 and 7
  6. gdebi: command not found
  7. Configure VSFTPD Chroot Environment in CentOS and RHEL
  8. ipcalc Command Examples in Linux
  9. Configure Persistent NIC Names of Network Adaptors in CentOS/RHEL using udev Rules
  10. pvchange Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright