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.
Step 1: Switch to Apt directory of Kali Linux
On the Command terminal type;
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.
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
Step 6: Use ifconfig command to check Ip address on Kali Linux
Finally, you can check the Ip address without any error: