ifconfig command is used to view and configure network interfaces on Linux systems. However, in some Linux distributions like Ubuntu and Fedora,
ifconfig may not be installed by default or could be deprecated.
If you try to run
ifconfig and get an error like:
-bash: ifconfig: command not found
Here are some things you can try to troubleshoot and restore access to the ifconfig command on Linux:
Table of Contents
Check Alternative Commands
Most modern Linux distributions use the
ip command instead of
ip command has similar functionality to view and configure network interfaces.
To view interfaces, use:
ip addr show
To assign an IP address, use:
ip addr add 192.168.1.10/24 dev eth0
So in many cases, you can just use
ip instead of
Some systems also have
nmcli available to view network configuration from NetworkManager.
For example, to show interfaces:
nmcli device status
Install ifconfig Package
If you still need or want to use
ifconfig, try installing it directly:
sudo apt install net-tools
sudo yum install net-tools
sudo dnf install net-tools
After installing the
ifconfig should be available.
Check System Path
In some cases,
ifconfig could still be installed but not available in your system path.
Check if it exists with:
If it shows nothing, try locating
If it exists in a non-standard path like
/usr/sbin/ifconfig, you can either add that path to your environment, symlink
ifconfig, or reinstall
Use Static Build
ifconfig package is available for your distribution, you can download and compile a static build:
tar xvzf net-tools-2.10.tar.gz
./configure --prefix=/usr --static
make -C man
make -C po
This will manually install a static
ifconfig binary into your system.
When running inside a container or chroot jail, the network interfaces and
ifconfig binary may not be available.
ifconfig from the host system instead or reconfigure networking to expose interfaces inside your container/jail.
nmclifor most network configuration tasks instead of
- Install the
net-toolspackage if you specifically need the
- Check system path and symlinks if
ifconfigseems to exist but command not found
- Compile a static build as a last resort if no packages available
- Ensure proper container/chroot networking setup if applicable