Skip to main content
Installation

ifconfig command not found? Install ifconfig on Ubuntu

The ifconfig utility is being deprecated in favor of the new ip commands. However, it is still widely used and hence still available to install in Ubuntu

Sagar Sharma

If you are into networking, the ifconfig is one of the most basic networking commands and is mainly used to check the ip address, assign an address to a network interface and to display the current network configuration.

But the problem kicks in when you try to use the ifconfig command and it gives you an error saying ifconfig command not found:

Command 'ifconfig' not found

And to solve this issue, all you need is to execute the following command to install the ifconfig on your system:

sudo apt install net-tools

Want a more detailed solution? Here you have it.

Solve 'ifconfig command not found' issue in Ubuntu

The ifconfig utility is being deprecated in favor of the new ip commands. However, it is still widely used and hence still available to install in Ubuntu.

The ifconfig utility is part of the net-tools, a collection of programs used to configure the network in Linux.

Which simply means you can not use 'apt install ifconfig' command for installing it.

You'd have to use the net-tools as a package name with the apt install command as shown below:

sudo apt install net-tools 

Once you are done with the installation, you can execute the ifconfig command in the terminal to check whether the package was installed correctly or not:

ifconfig 
use ifconfig command in ubuntu

And you'd get a similar result as an output of the ifconfig command.

💡
Some distros may require you to use sudo with ifconfig

Still, showing the ifconfig command not found?

For the majority of the users, installing the net-tools package should solve this issue.

First, let's check where the binaries for the ifconfig exist in the sbin directory using the following command:

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

And if you have the net-tools installed, you will get the output saying ifconfig exists:

check whether ifconfig exist or not in ubuntu

If you don't get the similar output shown in the above snapshot, you'd have to install the net-tools again.

Once you are done, check the contents of the PATH variable and look for the /sbin:

echo $PATH

Probably, you won't find the /sbin here and that's the root cause of this error.

So you'd have to manually add the sbin to the PATH variable using the following:

export PATH = $PATH:/sbin

Once done, reboot your system and you'd have the ifconfig command working!

Just getting started with Networking?

So if you are just getting started with networking, it is necessary to know the basics and for that purpose, we have a dedicated guide covering the basic Linux networking commands:

21 Basic Linux Networking Commands You Should Know
A list of basic Linux networking commands that will help you troubleshoot network issues, monitor packets, connect devices, and much more.

I hope you will find this guide helpful.

And if you have any suggestions or queries, feel free to ask in the comments.

Sagar Sharma