In versions before 15.04 there used to exist nm-tool
utility.
From man nm-tool
:
NAME
nm-tool - utility to report NetworkManager state and devices
SYNOPSIS
nm-tool
DESCRIPTION
The nm-tool utility provides information about NetworkManager, device, and wireless networks.
This small utility would interface nicely with the Network Manager and produce a report with appropriate information on each line, which was quite simple to parse with text processing utilities. Sample output:
$ nm-tool | sed -ne '/^ *IPv4/,/^$/p'
IPv4 Settings:
Address: 192.168.42.178
Prefix: 24 (255.255.255.0)
Gateway: 192.168.42.129
Rinzwind's answer on the related question has cited the changelog for Network Manager package, which explains that it has been dropped upstream and superseded by nmcli
. It should be noted, however, that nmcli
before and after 15.04 differs with several command-line arguments. Here's alternative to the above:
$ nmcli dev show | grep 'IP4\.ADDRESS\|IP4.GATEWAY'
IP4.ADDRESS[1]: 192.168.0.101/24
IP4.GATEWAY: 192.168.0.1
IP4.ADDRESS[1]: 127.0.0.1/8
IP4.GATEWAY: --
With nmcli
information is shown in accordance with each interface, i.e. there's set of lines for one interface, then separated by a blank line another set of lines and so forth.
Another alternative that one can use would be ip
command which is preferred nowadays to ifconfig
. According to pilona's and Gilles's answers on Difference between 'ifconfig' and 'ip' commands, Linux kernel and networking features have advanced forward but ifconfig
and the package to which it belongs haven't evolved in a long time, and that's why we have ip
utilities. For getting the addressing information on specific interfaces ip -o -4 addr
can be used and ip route
can be used for getting routing/gateway information.