Categories: TutorialsUbuntu

How to Fix “firewall-cmd: command not found” error in Linux

firewall-cmd is a command line interface for firewalld, a popular firewall software for Linux systems. Firewalld offers many useful features and is often employed by many Linux system administrators to manage their networks & systems. While using firewall-cmd you may get an error ‘firewall-cmd command not found’. In this article, we will learn how to fix this issue.

How to Fix “firewall-cmd: command not found” error in Linux

This error mainly occurs because firewalld tool is not installed on your system, not properly installed on your system, or is outdated. Many systems, especially cloud virtual machines, have firewalld installed but not firewall-cmd. So when you try to configure firewall using firewall-cmd, you may get this error.

Sponsored

The solution is to install firewalld on your system. It already contains firewall-cmd packaged into it. Open terminal and run the following command for this purpose. If you have already installed it, you can skip this step.

$ sudo yum install firewalld

Next, run the following commands to start and enable autostart for firewalld, at system boot.

$ sudo systemctl start firewalld
$ sudo systemctl enable firewalld
$ sudo systemctl status firewalld

Once you have installed firewalld, you can use the following commands to open ports, e.g. port 80, and reload configuration to apply changes. Please note, we are using firewall-cmd command to manage ports.

$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload

Similarly, here are the commands to block ports.

Sponsored
$ sudo firewall-cmd --zone=public --remove-port=80/tcp --permanent
$ sudo firewall-cmd --reload

In this article, we have learnt how to fix ‘firewall-cmd: command not found’.

Also read:

How to Protect Hard & Symbolic Links
How to Run Shell Script on Another Server
How to Manage Systemd Services on Remote Linux Systems
How to Synchronize Time With NTP in Linux
How to Enable Rm Confirmation in Linux

The post How to Fix “firewall-cmd: command not found” error in Linux appeared first on Fedingo.

Ubuntu Server Admin

Recent Posts

New 50 TOPS DC-ROMA RISC-V AI PC ships with Ubuntu Desktop 24.04 LTS pre-installed

Canonical is excited to announce the launch of DeepComputing’s new 50 TOPS DC-ROMA RISC-V AI…

2 days ago

CRA compliance: Things IoT manufacturers can no longer do under the CRA (and what to do instead)

I’ve written about the EU Cyber Resilience Act (CRA) on our Canonical blog a few…

4 days ago

IBM LinuxONE 5 and Ubuntu Server, a great combination from day one

Today, IBM announced the launch of their latest server: the new IBM LinuxONE Emperor 5.…

5 days ago

Ubuntu Weekly Newsletter Issue 890

Welcome to the Ubuntu Weekly Newsletter, Issue 890 for the week of April 27 –…

6 days ago

Ubuntu IoT Day in Singapore – Unlock compliant and scalable innovation in edge AI

Singapore | May 27, 2025 | Full-day event How do you build robust, performant edge…

6 days ago