ifconfig and networking with windows 7
Hello all. My name is jason and I have a slight problem and Im new to linux. I actually found a similar thread but no solution. It did get me going in right direction, but as I ve said, no solution....that I know of.
I am running a mepis machine and I believe it is based on debian/ubuntu SQueeze. When I open konsole/terminal and type 'ifconfig' , I get "Command not found". Following some reading I found that ifconfig is in sbin folder of mepis.
I cd into sbin folder and typed ls. Sure enough, ifconfig is listed. So then, since i was already in the sbin folder, I typed 'ifconfig' again and I received the same 'command not found'. Can someone tell me what I am doing wrong ? I very much appreciate you taking time to read this as I am certain you have received this particulay query before.
Also on a side note: how come when I type something like "cd /home/username/Music", I get no file or directory exist. Yet if I type all of that without the /'s it works ? EX. "cd home username Music it works .
/sbin does not appear in the path of users, only of root.
Linux only executes programs which can be found in the path.
When you provide the full path: /sbin/ifconfig, the program is executed.
When you are in /sbin and try to execute something, the current directory is still not in your path.
Try ./ifconfig from within /sbin and it executes.
If you want to execute an action which requires root permissions you can use sudo. Then the path is also set correctly to execute programs from /sbin.
You also could add /sbin to your path, but then again it is for a reason that /sbin is not in your path.
Welcome to LinuxQuestions.
Unlike windows, linux only uses the path environment when searching for a file regardless of your current working directory. Many distributions do not include the /sbin directory in the users path. In addition if you su root you will still use the users environment but su - will use root's environment. You can always use the full or absolute path i.e /sbin/ifconfig
Also . is a shortcut for current working directory so ./my_program will run a program in the current working directory regardless of absolute path.
cd my_directory will work only if there exists a subdirectory in the current directory called my_directory which is known as a relative path.
cd /my_directory is an absolute path.
linux is case sensitive so it difficult to tell if you made a mistake when using the absolute path.
Thanks for the responses. I don't know why I didnt try su or sudo before. I just didnt think to do that as it is debian based and Ive dabbled with ubuntu and I didnt have to sudo for theirs.
Anyway. Again thank you both.
|All times are GMT -5. The time now is 11:42 PM.|