Navigation

RSS 2.0 New Entries Syndication Feed Atom 0.3 New Entries Syndication Feed

Show blog menu v

 

General

Use it

Documentation

Support

Sibling projects

RIFE powered

Valid XHTML 1.0 Transitional

Valid CSS!

Blogs : Latest entries

avatar
Handy one-liner: get current IP address on Linux

This took me a little bit longer that I'd hoped, I tried with awk first but finally settled on perl. Maybe this could be handy for someone else if you need to have the current IP address of eth0 isolated for shell scripting:

ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }'

Could result into:

216.182.233.220
posted by Geert Bevin in IT on Jan 18, 2007 8:11 PM : 10 comments [permalink]
 

 
 
 
Google
rifers.org web