LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I can't run ifconfig (https://www.linuxquestions.org/questions/linux-newbie-8/i-cant-run-ifconfig-922831/)

nanch 01-09-2012 03:59 AM

I can't run ifconfig
 
I have installed centOS, an tryn to run ifconfig and it keeps telling me command not found, wats the right directory to run the command from?

EricTRA 01-09-2012 04:02 AM

Hello and welcome to LinuxQuestions,

Are you running that as a regular user or as root? I suppose as a regular user which would mean that /sbin is not in your default PATH. Did you try running it with sudo like this:
Code:

sudo ifconfig
or
Code:

sudo /sbin/ifconfig
Looking forward to your participation in the forums. Have fun with Linux.

Kind regards,

Eric

rockstar05 01-09-2012 04:32 AM

If this is not working then please find the ifconfig file through / directory.

by,

find / -name ifconfig

and place in proper place /sbin directory

so you can use ifconfig command.

Thanks

linuxmen 01-09-2012 05:21 AM

Which version of CentOS ?
But all users can run ifconfig without any errors..

deep27ak 01-09-2012 05:26 AM

Quote:

Originally Posted by nanch (Post 4570001)
I have installed centOS, an tryn to run ifconfig and it keeps telling me command not found, wats the right directory to run the command from?

lookout for the default location of command
Code:

#which ifconfig
/sbin/ifconfig


then try running the command this way
Code:

#/sbin/ifconfig

EricTRA 01-09-2012 05:31 AM

Quote:

Originally Posted by linuxmen (Post 4570060)
Which version of CentOS ?
But all users can run ifconfig without any errors..

Hi,

That is not always true. Depends on how the system is set up. If you have a regular user with limited access, controlled by sudo for example and you didn't allow ifconfig (NETWORKING) then it will not work. Another issue is that for regular users /sbin might not be in the PATH statement so just running
Code:

ifconfig
,
even with sudo correctly setup and allowing the command, would error out whereas running
Code:

/sbin/ifconfig
would give the desired result.

Kind regards,

Eric

Blommeke77 02-26-2015 03:40 AM

Hi All,

I know it is an old thread, but I ran into the same issue on my CentOS 7 server.
The solution for me was to install the net-tools because I couldn't find ifconfig on my machine at all.

Code:

yum install net-tools
After that I could succesfully execute ifconfig.
Since this thread pups up when searching for this issue, I think it's best to add all proper solutions.

Best regards,

John


All times are GMT -5. The time now is 01:48 PM.