bashipnetplan

List all IP's using the command "ip" and not "ifconfig"


I am trying to find a command that can list all the IPs (only the ip's) using the "ip" command in ubuntu 20.04.

Ip a outputs way too much, so I tried to output only a bit of it without success using ip -c -6 -o a or ip -c -4 -o a for ipv4.

Does anyone know how to list simply all the IPs of the system using the ip command. I can't find anything except by using ifconfig, which I don't want to instal just to run this script.

Thanks for your help !


Solution

  • Please, try this command

    hostname -I