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

How is Livepatch safeguarded against bad actors?

Canonical Livepatch is a security patching automation tool which supports reboot-less security updates for the…

1 hour ago

Accelerating data science with Apache Spark and GPUs

Apache Spark has always been very well known for distributing computation among multiple nodes using…

1 hour ago

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

1 day ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

1 day ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

1 day ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago