So some genius changed the way this is printed. On the Raspberry with Raspbian (Debian Jessie):
$ /sbin/ifconfig eth0
eth0 Link encap:Ethernet HWaddr b8:27:eb:71:d5:56
inet addr:192.168.0.11 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::1e43:2c74:e7d6:6419/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:165 errors:0 dropped:0 overruns:0 frame:0
TX packets:135 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:17459 (17.0 KiB) TX bytes:18391 (17.9 KiB)
On my laptop (Debian Stretch):
$ /sbin/ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.77 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::39db:8c13:722f:b088 prefixlen 64 scopeid 0x20<link>
ether 40:b0:34:96:d9:02 txqueuelen 1000 (Ethernet)
RX packets 118126 bytes 23261567 (22.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 319445 bytes 452933203 (431.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xcc200000-cc220000
I had code that parses for "inet addr:"
, this obviously fails now on the laptop. Is there a unique way to get, using a shell command, the eth0 IP address on both Raspbian/Jessie and Stretch?
ip
, eg.ip -4 addr show dev eth0
? – sebasth Aug 05 '17 at 14:40ifconfig
is depracated, that's another reason to replace it byip
– VPfB Aug 05 '17 at 15:47