A Blog about technology, linux, peer2peer, cool new downloads and software development.

Monday, March 17, 2008

Display IP address in bash prompt

cat ~/.bashrc
export PS1=`/sbin/ifconfig eth0:1 | /usr/bin/perl -ne 'if ( m/^\s*inet (?:addr:)?([\d.]+).*?cast/ ) { print qq($1\n); exit 0; }'`:$PS1

 

Replace eth0:1 with the name of the network interface

No comments: