[Solved] bash: ifconfig: command not found

In this tutorial, we will learn about how to fix the error bash: ifconfig: command not found in Linux. ifconfig command is supported by all Unix-based operating system. Similarly ipconfig command is used by Windows operating system.


ifconfig Overview

ifconfig (interface configuration)  is CLI (command line interface) command which is part of net-tools utility. ifconfig command is use to get the configuration details of current network interface. It is also use to assign ip address to a network interface, view the status of interface and configure the interface. ifconfig command is mostly supported on Debian, Ubuntu and Linux Mint distribution of Linux. All the modern Linux distribution like CentOS, Rocky Linux  uses IP command which works the same way as ifconfig command does.


[Solved] bash: ifconfig: command not found

How to fix bash: ifconfig: command not found

Also read: 10+ important Linux command

Now that we got the idea of what ifconfig command is and how does it work, let’s fix the error by  following below steps.

Step-1: Become root

In this step, switch to super user in order to install the net-tools package in the machine using below command.

[user@linuxnasa]$sudo su


Step-2: Check OS distribution

In this step, check which Linux distribution is running using below command. I am using Debian OS.

[root@linuxnasa~]# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION="11 (bullseye)"


Step-3: Check ifconfig binary

In this step, check if binary file of ifconfig command is available using below command. If below command doesn’t give any output, that means binary is not present in the machine Hence, ifconfig command is unavailable in the machine.

[root@linuxnasa~]# which ifconfig


Step-4: Update Debian Repo

In this step, update the apt-get repository using below command. This will install the latest version of all the packages which are already installed in your machine.

[root@linuxnasa~]# apt-get update
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [237 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [14.6 kB]
Fetched 8643 kB in 2s (4898 kB/s)
Reading package lists... Done


Step-5: Install net-tools package

In this step, install the net-tools package from the apt-get repository using below command.

[root@linuxnasa~]# apt-get install net-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 250 kB of archives.
After this operation, 1015 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 net-tools amd64 1.60+git20181103.0eebece-1 [250 kB]
Fetched 250 kB in 0s (834 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package net-tools.
(Reading database ... 7826 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60+git20181103.0eebece-1_amd64.deb ...
Unpacking net-tools (1.60+git20181103.0eebece-1) ...
Setting up net-tools (1.60+git20181103.0eebece-1) ...


Step-6: Check ifconfig binary path

In this step, again execute the previous command to check if ifconfig binary is present in the machine. This time below command will give the path of ifconfig binary as output.

[root@linuxnasa~]# which ifconfig


Step-7: Execute ifconfig command

In this step, after installing the net-tools package, you now should be able to execute ifconfig commands to get the network interface details.

[root@linuxnasa~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9001
inet netmask broadcast
ether 4a:51:2f:43:d1:a4 txqueuelen 0 (Ethernet)
RX packets 1306 bytes 8984416 (8.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 970 bytes 65598 (64.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet netmask
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0



We installed the net-tools package to make the ifconfig work. Similarly if you face similar issue in any other distribution of Linux, check which network interface utility is used by that distribution and install the corresponding package in the machine to fix the issue.



Leave a Comment