I\'m trying to use just the IP address (inet) as a parameter in a script I wrote.
Is there an easy way in a unix terminal to get just the IP address, rather than loo
I wanted something simple that worked as a Bash alias. I found that hostname -I
works best for me (hostname v3.15). hostname -i
returns the loopback IP, for some reason, but hostname -I
gives me the correct IP for wlan0, and without having to pipe output through grep or awk. A drawback is that hostname -I
will output all IPs, if you have more than one.