I’ve actually written about ifconfig not found before, but noticed recently another possible scenario so will mention it today.
Make Sure Net-Tools Package is Installed
This is still the most common reason for your shell not finding the ifconfig command: it’s just not installed by default. So install it using apt command:
Call ifconfig Using Full Path
This is the thing I noticed on my Debian VM earlier today: your regular user may not have /sbin directory in its PATH. Which means ifconfig command will still not work if you just type the command name:
But if you type the full path to the command, it will work:
Update PATH Variable to Include /sbin
Edit the .profile file in your home directory. For me it’s /home/greys/.profile.
Somewhere towards the end of it there should be a PATH variable updates section, on my VM it includes linuxbrew that I installed recently:
We need to update this section. And if there isn’t one, just create another one at the end of the file. Both changes should aim to add /sbin directory to the PATH variable.