First use this commands to see your IP and IPv6 address and interfaces.
1 2 3 | /sbin/ifconfig $1 | grep "inet\|inet6" | awk -F' ' '{print $2}' | awk '{print $1}' /sbin/ifconfig |grep -B1 "inet\|inet6" |awk '{ if ( $1 == "inet" || $1 == "inet6" ) { print " ",$2 } else if ( $1 != "inet" && $1 != "inet6" ) { print $1 } }' |
Now if you want to use this every day, just open your .bashrc file from your home folder.
Add these functions to the .bashrc file:
1 2 3 4 5 6 7 8 | # User specific aliases and functions function getip { /sbin/ifconfig $1 | grep "inet\|inet6" | awk -F' ' '{print $2}' | awk '{print $1}'; } function getips { /sbin/ifconfig |grep -B1 "inet\|inet6" | awk '{ if ( $1 == "inet" || $1 == "inet6" ) { print " ",$2 } else if ( $1 != "inet" && $1 != "inet6" ) { print $1 } }'; } |
Now open a new terminal shell and use it:
1 2 | $getip $getips |