grep ifconfig list ips

July 4, 2011

Linux ifconfig Example

Type the following command:

ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'

FreeBSD/OpenBSD ifconfig Example

Type the following command:

ifconfig  | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'

Sun / Oracle Solaris Unix Example:

Type the following command:

ifconfig -a | grep inet | grep -v '127.0.0.1' | awk '{ print $2}'

that's how you grep ifconfig listips