-1

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 !

Poli
  • 113
  • 14
  • 1
    I'm voting to close this question as off-topic because this question belongs on [Ask Ubuntu](http://askubuntu.com/tour) in the Stack Exchange network. – Cyrus Oct 16 '20 at 09:37
  • 1
    Not necessarly as I am doing a bash script and not specifically only for ubuntu 20.04. – Poli Oct 16 '20 at 09:46

2 Answers2

3

Please, try this command

hostname -I
Ivan
  • 6,188
  • 1
  • 16
  • 23
0

Parse ifconfig to get only my IP address using Bash

Founded someone also replying for ip addr but I will use hostname -I as @Ivan said.

Poli
  • 113
  • 14