Skip to content

Commit 0480e7d

Browse files
committed
Retrieve local ip independently
Signed-off-by: Merlin Rabens <m.rabens@hotmail.de>
1 parent 5368015 commit 0480e7d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.aliases

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ alias canary='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Ch
5757

5858
# IP addresses
5959
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
60-
alias localip="ipconfig getifaddr en0"
60+
alias localip="echo $(ifconfig -a | grep -E 'UP|inet[^6]' | grep -A1 UP | grep inet | grep -v 127 | tail -1 | awk '{print $2}')"
6161
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
6262

6363
# Show active network interfaces

0 commit comments

Comments
 (0)