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

Everything you need to know about FIPS 140-3 on Ubuntu | Videos

FIPS 140 is a highly demanding security standard that’s mandatory for almost all high-security and…

5 hours ago

A CISO’s preview of open source and cybersecurity trends in 2026 and beyond

Open source has come a long way. Recently I was watching a keynote address by…

5 days ago

Canonical Kubernetes officially included in Sylva 1.5

Sylva 1.5 becomes the first release to include Kubernetes 1.32, bringing the latest open source…

5 days ago

Canonical expands total coverage for Ubuntu LTS releases to 15 years with Legacy add-on

Expansion ensures business continuity without forcing major upgrades Today, Canonical announced the expansion of the…

6 days ago

Announcing YARD-Lint: Keep Your Ruby Documentation Solid

TL;DR: YARD-Lint catches documentation issues, just like RuboCop for code. Star it and use it…

6 days ago

Canonical releases FIPS-enabled Kubernetes

Deploy a FedRAMP-ready kubernetes cluster and application suite, with FIPS 140-3 crypto and DISA-STIG hardening…

1 week ago