How to get lan ip address as output in Manjaro in the terminal?

I have a script which I used to use in ubuntu. It got my lan ip address using the command hostname -I. I would get an output like as a string which I can use somewhere else.

However, with Manjaro, the command doesn’t exist, when I tried hostname -i, (lowercase) but i get I even installed the dnsutils.

Is there a way I can get my address on the LAN as an output from any command / tool in Manjaro?

ip address show

1 Like

the whole infos : ‘nmcli device show’
with grep you can filter
nmcli device show | grep IP4.ADDRESS
or save it to a temporary file
nmcli device show | grep IP4.ADDRESS > test.txt
from there you can parse the output with head, tail or whatever you want

Good advice: I would add, in this case, eg, that I feed the output to head, awk, rev and cut (and again rev):

nmcli device show | grep IP4.ADDRESS | head -1 | awk '{print $2}' | rev | cut -c 4- | rev

And so I get instead of