#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/ip public-ip () { local name=$funcstack[1] local url='http://checkip.amazonaws.com' local open_dns=opendns.com echo $(curl --no-progress-meter $url) "($name)" dig +short myip.${open_dns} @resolver1.${open_dns} } inet () { local name=$funcstack[1] echo $(hostname -I | awk '{print $1}') "($name)" ifconfig $net | awk '/mask/{print $2}' ip addr show $net | awk '/inet /{print $2}' | cut -d '/' -f 1 } list-ip () { public-ip inet } alias lip=list-ip # $ lip # 92.34.142.23 # 92.34.142.23 # 192.168.10.224 # 192.168.10.224 # 192.168.10.224