How to Fix the “ifconfig: command not found” Error in Linux | TechBuzz

- Advertisement -

ifconfig is a handy networking utility that fetches important data related to the network interface of your machine. It used to come pre-installed in all Linux distributions, that is until it was unanimously declared deprecated by developers due to lack of maintenance.

This is why calling the ifconfig command from the terminal returns an “ifconfig: command not found” error. If you still want to use ifconfig on your Linux system, you’ll have to manually install it.

If you tried to install the ifconfig utility and failed, it’s because ifconfig cannot be individually installed. It is included with the net-tools package. To be able to use the ifconfig command, you have to install the net-tools package first.

To install the package on Linux, fire up the terminal and run the command corresponding to the Linux distro that you’re currently running:

- Advertisement -

On Debian/Ubuntu derivatives, run:

sudo apt install net-tools

On Arch-based systems, run:

- Advertisement -
sudo pacman -S net-tools

To install the net-tools package on Fedora, CentOS, and RHEL, issue the following command:

sudo dnf install net-tools
- Advertisement -

This should install the net-tools package on your Linux system, following which you will be able to run the ifconfig command without any errors.

Installing net-tools should fix the issue, but in some cases, the “ifconfig: command not found” error might persist even with the net-tools package installed on your system.


In this case, you have to manually update the system PATH variable and add the ifconfig binary to it.

Start off by verifying whether the ifconfig binary exists in the system binaries directory. You can check by either manually navigating to the /sbin directory with the cd command and looking for the ifconfig binary or automating the process with this one-liner:

[[ -f /sbin/ifconfig ]] && echo "ifconfig exists"

The output of this command should be “ifconfig exists”. If it returns an error or doesn’t print the said phrase, you need to re-install the net-tools package. Once you get the desired output, check the contents of the PATH variable with this command:

echo $PATH

Wade through the output and look for /sbin in it. Chances are you will not find it. If that’s the case, then export /sbin to your PATH variable with this command:

export PATH = $PATH:/sbin

Restart your Linux desktop after running this command. Upon boot-up, you should be able to use the ifconfig command flawlessly.

While you might find familiarity with ifconfig, it’s recommended you move on to updated tools that offer the same features with better performance.

When the net-tools package was declared deprecated, it was replaced with the iproute2 software suite that includes better alternatives like ip, cstat, arpd, nstat, devlink, ss, tc, and more.

The iproute2 package should already be installed on your Linux machine, so don’t worry about installation or configuration. You can simply run the commands.

To run the alternative to the ifconfig utility, type in this command:

ip a

You will find the output identical to that of the ifconfig command. You can get command-line help easily with the –help flag. Or if you want to learn more about each command, you can start by reading their man pages.

The Best Networking Commands for Linux

Linux is arguably the most popular operating system for servers and desktops alike. It never hurts to be familiar with a few useful commands that help with troubleshooting and configuring network settings. Since there are way too many networking commands to count, we’ve curated this list of some must-know Linux networking utilities.

10 Linux Network Commands and How to Use Them

Read Next

About The Author

Source link

- Advertisement -
I am admin of blog & I provide tech-related news. As a part of my hobby, I make content related to technology and gadgets reviews too. I love to be a content creator apart from it, I am a full-time employee in an MNC company and manage blogs systematically. You can mail me at [email protected]

More from author

Related posts


Latest posts

AstroForge raises $13 million to mine platinum on asteroids | TechBuzz

AstroForge wants to mine metals on near-Earth asteroids. Asteroids could be worth trillions of dollars. La startup AstroForge, based in California, can...

The Google Pixel with foldable screen postponed again | TechBuzz

Google smartphone with foldable screen postponed again. This would not happen again until next spring. Rumors have been going around for a...

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!