Answers for "linux show ip interfaces as table terminal"

0

linux show ip interfaces as table terminal

#Add this to ~/.bashrc

#Show IP interfaces and their IP address.
alias ipt='
echo -e "IPv4:\n-----------------" ;
ip -o a show | cut -d " " -f 2,7 | grep -v : | column -t
echo -e "\nIPv6:\n-----------------" ;
ip -o a show | cut -d " " -f 2,7 | grep : | column -t'

#Don't forget to "source ~/.bashrc" or open a new terminal for
#the changes to take effect.

#Now use the command "ipt" (IP Table) to show the IP adresses.

#Result
$ ipt
IPv4:
--------------------------------------------------
lo               127.0.0.1/8
wlp62s0          192.168.1.120/24
br-893178f29c57  172.18.0.1/16
docker0          172.17.0.1/16
enx3499710075c4  192.168.1.78/24

IPv6:
--------------------------------------------------
lo               ::1/128
wlp62s0          2a02:a44d:b51f:1:7031:271c:e56f:bd29/64
wlp62s0          2a02:a44d:b51f:1:afa3:9bad:5c44:dc77/64
wlp62s0          fe80::f684:745c:12a2:11c1/64
docker0          fe80::42:5fff:fe3c:6406/64
enx3499710075c4  2a02:a44d:b51f:1:34e6:2f34:2d59:6f6e/64
enx3499710075c4  2a02:a44d:b51f:1:db0d:8e39:8805:11c8/64
enx3499710075c4  fe80::fdd7:9af0:e70a:4db0/64
veth9fcdd47      fe80::2cb6:c5ff:febe:9b6e/64
Posted by: Guest on March-02-2021

Code answers related to "linux show ip interfaces as table terminal"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language