LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-15-2005, 07:50 PM   #1
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
detecting my IP



STATUS: Solved
The solution is in post #5. Thanks to ilikejam for suggesting the other solution (which requires root, though).


howdy.

upon running dhclient, I get assigned an IP adress as usual. What I want to know is if there's an easy way (read: command-line tool) of finding out what that IP adress was?

for example, I'd like to say
$ echo "here I am: " `the_tool_in_question` | mail spam@bacon.egg

thanks,

Jonas Kölker

Last edited by jonaskoelker; 09-10-2005 at 12:39 PM.
 
Old 01-15-2005, 08:12 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
It's a bit convoluted, but try this (as root)
Code:
ifconfig eth0 | grep "inet addr:" | cut -d: -f 2 | awk '{ print $1 }'
Dave
 
Old 01-16-2005, 04:03 AM   #3
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Original Poster
Rep: Reputation: 47
thanks. though I prefer to use sed
anyways, I found a way to do it non-root (now I feel silly for asking)

anyways, thanks for taking your time

Jonas Kölker
 
Old 01-16-2005, 05:56 AM   #4
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
How did you do it non-root?
 
Old 01-16-2005, 06:23 AM   #5
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Original Poster
Rep: Reputation: 47
$ ip addr show eth0 # or
$ ip addr show scope global # or
$ ip --help
it's a part of the debian package 'iproute'.

Hope this helps,

Jonas
 
Old 01-16-2005, 06:45 AM   #6
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Ah. I don't have 'ip' installed.

Cool.

Dave
 
  


Reply



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
Detecting an H320... darkarcon2015 Linux - Hardware 0 01-05-2005 03:28 PM
Detecting modem pengie Fedora 8 12-21-2004 11:17 PM
detecting '\t' haobaba1 Programming 5 02-22-2004 11:01 AM
detecting spam andy18 Linux - Security 7 12-16-2003 11:38 AM
Modem not Detecting muhammadawood Linux - Hardware 3 12-20-2002 02:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:30 PM.

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
Open Source Consulting | Domain Registration