Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Fix "ifconfig: command not found" on Linux

Install the net-tools package, or use the newer ip command.

VPS and Cloud Servers2 min read4 steps4 screenshots

Why it happens

The ifconfig command not found error
  1. Old tool. ifconfig is deprecated, and new distributions do not install it.
  2. Missing package. ifconfig is part of the net-tools package.
  3. No permission. Some users cannot run it without sudo.
  4. PATH. The folder with ifconfig (/sbin) is not in your PATH.

Install net-tools

On Debian and Ubuntu:

sudo apt update
Updating the package list
sudo apt install net-tools
Installing net-tools
ifconfig works now

On CentOS, Red Hat and Fedora:

sudo yum install net-tools

On Arch Linux:

sudo pacman -S net-tools

Use the full path

sudo /sbin/ifconfig

Add /sbin to PATH

Show the current value:

echo $PATH

Add the folder for this session:

export PATH=$PATH:/sbin

To make it permanent, add that line to ~/.bashrc.

Run with sudo

sudo ifconfig

Use the ip command instead

The ip command is the modern replacement and is installed by default:

ip addr show
ip link show
OldNew
ifconfigip addr show
ifconfig eth0 upip link set eth0 up
route -nip route show
netstat -tulnss -tuln

Tips

  • After you install net-tools, run ifconfig to check that it works.
  • If you have several copies, use the full path to pick one.
  • It is better to learn the ip command, because ifconfig may disappear.

Quick recap

  • Install net-tools, or use ip addr show.
  • Add /sbin to the PATH if the command still is not found.