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

AI in 2025: is it an agentic year?

2024 was the GenAI year. With new and more performant LLMs and a higher number…

5 hours ago

Canonical announces 12 year Kubernetes LTS

Canonical’s Kubernetes LTS (Long Term Support) will support FedRAMP compliance and receive at least 12…

1 day ago

Ubuntu Weekly Newsletter Issue 878

Welcome to the Ubuntu Weekly Newsletter, Issue 878 for the week of February 2 –…

2 days ago

How your feedback shapes the way we support open source software

At Canonical, we firmly believe that delivering an outstanding, customer-centric support experience is impossible without…

2 days ago

How To Install osTicket v1.14 On Ubuntu 20.04

I want to share how to install osTicket v1.14 for Ubuntu 20.04 server. osTicket written…

3 days ago

How To Install WordPress On Ubuntu 20.04

Now I want to share how to install WordPress on ubuntu 20.04 server. WordPress is…

3 days ago