Cloudevelops The Official Cloudevelops Blog

CLI magic

Today we would like to share some CLI magic. So for example instead of using this long bash spaghetti command:

ip=$(/sbin/ifconfig | grep "inet addr" | grep -v 127.0. | sed -r "s/.*addr:([^ ]+) .*/\1/") - here we want to find all IP addresses on target host.

You can just use this simple and clear basic command:

hostname -I

Check out man page for hostname command too: hostname

Share this article: