File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ alias canary='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Ch
5757
5858# IP addresses
5959alias ip=" dig +short myip.opendns.com @resolver1.opendns.com"
60- alias localip=" echo $( ifconfig -a | grep -E ' UP|inet[^6]' | grep -A1 UP | grep inet | grep -v 127 | tail -1 | awk ' {print $2}' ) "
6160alias ips=" ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\" ); print }'"
6261
6362# Show active network interfaces
Original file line number Diff line number Diff line change @@ -169,3 +169,9 @@ function o() {
169169function tre() {
170170 tree -aC -I ' .git|node_modules|bower_components' --dirsfirst " $@ " | less -FRNX;
171171}
172+
173+ # echo the IP address for the currently active network interface
174+ function localip() {
175+ local activeIf=$( netstat -rn | grep default | awk ' {print $NF}' | head -1)
176+ ipconfig getifaddr ${activeIf}
177+ }
You can’t perform that action at this time.
0 commit comments