LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 12-11-2005, 06:36 AM   #1
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676
Blog Entries: 7

Rep: Reputation: 32
how to display my IP addresses "ONLY"


Hi guys I wondered if there is a way to "grep" the output of the ipconfig -a command so that only the ip addresses are shown........or even better the name of the nic and the ip address together.
Actually, Ive seen such a thread in this forum, but I could not find it again .....

Thanks for the help
 
Old 12-11-2005, 06:48 AM   #2
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
/sbin/ifconfig -a | grep "inet add" | cut -f2 -d\: | cut -f1 -d" "
Solves the first problem..........what about the second case ?
 
Old 12-11-2005, 07:12 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Don't know if you actually need the -a option with ifconfig (-a also shows dummy0, which has no ip).

If not:

ifconfig | awk '/^[a-z]/ { printf("%s", $1) } /inet add/ { print $2 }' | sed 's/addr:/ /'

Hope this helps.

PS: If -a must be used and device is called dummy0:

ifconfig -a | awk '/^[a-z]/ { printf("%s", $1) } /inet add/ { print $2 }' | sed -e 's/dummy0/dummy0\n/' -e 's/addr:/ /'

Last edited by druuna; 12-11-2005 at 07:17 AM.
 
Old 12-11-2005, 08:51 AM   #4
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
Thanks that did the job........
 
Old 12-14-2005, 02:46 AM   #5
jitendra4u
LQ Newbie
 
Registered: Dec 2005
Posts: 1

Rep: Reputation: 0
Hi,


I think this could be help you , I don't know whether u want this out put something else
ifconfig | grep "eth0" | cut -d " " -f1; ifconfig -a | grep "inet addr" |cut -f2 -d\: | cut -f1 -d" "



Thanx

Jitendra Kumar
 
  


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
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 03:07 PM
how to solve missing "XFree86-DRI" on display ":0.0" digitX Linux - Software 13 03-05-2005 03:46 AM
Xlib: extension "XFree86-DRI" missing on display ":0.0". fostiator Linux - Hardware 15 02-20-2005 07:13 AM
Xlib: extension "GLX" missing on display ":0.0". tekmorph Linux - Hardware 1 12-05-2004 01:52 AM
bash-2.05b# Xlib: extension "XFree86-DRI" missing on display ":0.0". citrus Linux - General 8 02-22-2004 10:43 AM

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

All times are GMT -5. The time now is 04:27 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