RSS feed

unix print ip

November 29th, 2008 | Posted in Linux | No Comments

If you ever needed to get your own IP from shell to use in scripts…

host $(who -m | awk '{ print $5 }' | sed 's/[()]//g') | awk '{ print $4 }'

Above code is used in a script which updates apache ACL’s with current IP… makes it much easier than manually editing.



No Comments to “unix print ip”

There are no comments yet, add one below.

Comments are closed.


Leave a Comment






Categories