Today, ifconfig was not working for me. I think this happened after I installed X11 on my headless server.
$ ifconfig
bash: ifconfig: command not found
It turns out something removed /sbin from my $PATH. Read more about the $PATH here.
The ifconfig-command resides in /sbin:
$ whereis ifconfig
ifconfig: /sbin/ifconfig
The solution is to put something like this in your .bashrc:
PATH=$PATH:/sbin
export PATH