Solve Kali Linux error – bash: ifconfig: command not found

Kali Linux is one of the most popular distros to learn and perform ethical hacking and penetration testing tasks. However, if you have recently installed Kali on your computer or Virtual Machine then you definitely want to see your IP address of the computer via command-line tool. However, as you use the command ifconfig you may see an error “bash: ifconfig: command not found“. So, to solve this generally, we start installing net-tools but that will also give an error “Unable to locate package net-tools“. Henceforth, what to do now? Don’t worry, go through the steps given in this tutorial and you will be good to go.

bash ifconfig- command not found-min

Step 1: Switch to Apt directory of Kali Linux

On the Command terminal type;

cd /etc/apt/

Step 2: Edit Sources.list

Now, what we have to do is to access and edit the sources.list file of Kali Linux where it saved its all system or official repositories. Use the nano command:

sudo nano sources.list

Step 3: Add official Kali repository

Copy-paste the below given official repositories. First one is the standard one while the second if you want to install source packages. However, only the first one will be enough.

deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib

After adding use CTRL+X, type Y and hit the Enter button.

Add official Kali repository-min

Step 4: Run system update command

To reflect the changes in the system and flush cache run the update command:

sudo apt update

Step 5: Install net-tools on Kali

Use the below command to get the network tools on your Linux, so that later we can use the ifconfig command.

sudo apt install net-tools

Install net tools on kali Linux-min

Step 6: Use ifconfig command to check Ip address on Kali Linux

Finally, you can check the Ip address without any error:

ifconfig

check ipaddress on Kali Linux-min

7 thoughts on “Solve Kali Linux error – bash: ifconfig: command not found”

  1. Hi Raj, I read your article “Solve Kali Linux error – bash: ifconfig: command not found”.
    It is not a mistake: for many years now net-tools and ifconfig are considered obsolete.

    “The modern replacement is iproute2, which is actively developed and, unlike net-tools,
    has support for all of the kernel networking stack’s fancier features.
    In theory, we all should have transitioned over to iproute2 at least ten years ago.”

    https://lwn.net/Articles/710533/

    Reply
  2. thank you very much. your article has solved my problem. I`m learning ethical hacking and this really really helpful for beginner ..

    Reply
    • @Qaiser, If you are using Latest Kali linux 2020 version then by default you have a unprivileged user and that user doesn’t have ifconfig directory in its PATH variable which is /usr/sbin/ifconfig. Just use sudo ifconfig command will work else you can invoke it using the absolute path $/usr/sbin/ifconfig

      Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.