9

I have a severe problem today: when I type ifconfig it does not show ip configuration on ubuntu 12.04. Can anyone help me on this?

Here is the result of ifconfig:

Command 'ifconfig' is available in '/sbin/ifconfig'
The command could not be located because '/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
ifconfig: command not found
Braiam
  • 67,791
  • 32
  • 179
  • 269
Farooq
  • 267

4 Answers4

33

You can do either of the following:

  • Open your ~/.bashrc file and write the following to the end:

    export PATH=$PATH:/sbin
    

and then do source ~/.bashrc or open a new terminal instance.

  • or open your /etc/environment and add /sbin to end of the PATH variable, so that is as follows:

    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/usr/games:/sbin"
    
Danatela
  • 13,243
  • 11
  • 45
  • 72
jobin
  • 27,708
3

Add /sbin to the system path by running,

export PATH=$PATH:/sbin

If you follow @nux's answer, you have to create symbolic links for all the command files which are presented inside /sbin directory.But if you follow this or @jobin's answer, you don't need to go for that.

Avinash Raj
  • 78,556
2

You'll need to add /sbin to your path environment variable

  1. Create a new file in /etc/profile.d/custom-envs.sh (file must ends with .sh)

    set the following file content:

    export PATH=$PATH:/sbin
    
  2. Add execute permissions

    sudo chmod +x /etc/profile.d/custom-envs.sh
    

To apply changes, you'll need to logout and login again

VeLKerr
  • 233
-8

Try this command :

sudo ln -s /sbin/ifconfig /usr/bin/ifconfig
nux
  • 38,017
  • 35
  • 118
  • 131