LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ifconfig command (https://www.linuxquestions.org/questions/linux-newbie-8/ifconfig-command-4175507377/)

karthik.rajashekaran 06-07-2014 10:38 PM

ifconfig command
 
I know that the ifconfig command will output the ip address of the ethernet interfaces of your
machine.

But You will notice that if you type the command it returns an error due to the
fact that the command is not in your path.

How can I add the command “ifconfig” to your path
and show that it can be executed from any directory

allend 06-07-2014 10:48 PM

A temporary solution in your current shell
Code:

PATH=$PATH:/sbin
A more permanent solution would require editing shell startup files.

You can also prefix the command with the full path to the location of the command.
Code:

/sbin/ifconfig
BTW- ifconfig is being deprecated. http://linoxide.com/linux-command/use-ip-command-linux/

jdkaye 06-08-2014 03:26 AM

Normally, ifconfig can only be executed by root. You will find it is in the path if you try "sudo ifconfig" from a terminal or execute it as root.
Code:

~$ ifconfig -h
bash: ifconfig: command not found

but
Code:

~$ sudo ifconfig -h
[sudo] password for jdkaye:
Usage:
  ifconfig [-a] [-v] [-s] <interface> [[<AF>] <address>]
  [add <address>[/<prefixlen>]]
  [del <address>[/<prefixlen>]]
  ....

jdk

karthik.rajashekaran 06-08-2014 12:35 PM

Thanks a lot

jdkaye 06-08-2014 02:34 PM

1 Attachment(s)
If you consider your problem to be solved as a service to others please mark this thread as [SOLVED]. You can use the Thread Tools menu located above your first post in this thread (see the attachment).
jdk

DJ Shaji 06-14-2014 07:32 PM

Quote:

Originally Posted by allend (Post 5184383)
A temporary solution in your current shell
Code:

PATH=$PATH:/sbin
A more permanent solution would require editing shell startup files.

Add the above to ~/.bashrc


All times are GMT -5. The time now is 05:13 AM.