LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   today ifconfig no work yesterday it did (https://www.linuxquestions.org/questions/linux-newbie-8/today-ifconfig-no-work-yesterday-it-did-4175480549/)

albert0147 10-12-2013 02:11 PM

today ifconfig no work yesterday it did
 
Hello,
I am not a computer person. I am taking my second course at the local JUCO and have a question. The text book has : enter the command "ifconfig". I do this and it comes back with command not found. I then type "whereis ifconfig" then it says that "/sbin /ifconfig" so I type it and get on with the lab. I want to know why yesterday it was different and today it needs teh /sbin??
Take care

Robhogg 10-12-2013 03:19 PM

Hi albert,

Whether a command will be located depends largely on the contents of the $PATH environment variable. This is a list of directories (separated by colons), which will be searched for programs to execute. It can be different depending on your user and the version of Linux (among other things). For instance, /sbin is not in an ordinary user's $PATH in Debian by default, but it is (I think) in Ubuntu.

On my Debian laptop, you can see the difference, if I switch to the root user:

Code:

rob:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
rob:~$ sudo su - root
root:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

However, I could choose to add /sbin to $PATH as my ordinary user (and even make it permanent by adding it in my .bashrc file):

Code:

rob:~$ PATH=${PATH}:/sbin
rob:~$ export PATH
rob:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin
rob:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:19:b9:xx:xx:xx
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
...


albert0147 10-12-2013 08:51 PM

thanks RobHogg
It worked!


All times are GMT -5. The time now is 11:30 AM.