Poli
Poli

Reputation: 113

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 !

Upvotes: -1

Views: 1602

Answers (2)

Poli
Poli

Reputation: 113

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.

Upvotes: 0

Ivan
Ivan

Reputation: 7307

Please, try this command

hostname -I

Upvotes: 3

Related Questions