LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-07-2014, 10:38 PM   #1
karthik.rajashekaran
LQ Newbie
 
Registered: Jun 2014
Posts: 8

Rep: Reputation: Disabled
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
 
Old 06-07-2014, 10:48 PM   #2
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,603

Rep: Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509
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/
 
Old 06-08-2014, 03:26 AM   #3
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
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
 
Old 06-08-2014, 12:35 PM   #4
karthik.rajashekaran
LQ Newbie
 
Registered: Jun 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thumbs up

Thanks a lot
 
Old 06-08-2014, 02:34 PM   #5
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
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
Attached Thumbnails
Click image for larger version

Name:	lq_threadtools.png
Views:	9
Size:	26.8 KB
ID:	15695  
 
Old 06-14-2014, 07:32 PM   #6
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 517
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Quote:
Originally Posted by allend View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why "-bash: ifconfig : command not found" when typing "$ifconfig" dangdtvn Linux - Server 9 09-20-2013 06:01 AM
ifconfig command swift2008 Programming 4 09-30-2008 08:09 AM
Ifconfig command Gins Linux - General 6 07-22-2008 07:16 AM
connecting /sbin/ifconfig to bash command ifconfig flammable2 Fedora 4 11-12-2005 07:58 AM
IFConfig command dvong3 Linux - Networking 5 01-07-2004 07:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration