2

I had a weird situation yesterday when a shell script broke on the machine of colleague. the Script was parsing output from ifconfig, and it would assume that there was no : (colon) after the interface name.

E.g. directly behind the eth0:

eth0      Link encap:Ethernet  HWaddr 08:00:27:da:bb:a9
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feda:bba9/64 Scope:Link

I have confirmed already that the output is different between Distributions, e.g. on CentOS it looks quite different. I was wondering about a good way to version-track code like this. Given a specific Linux distro/version, how can I quickly get to the source code of its ifconfig program? How would I know, when it has changed the last time, or how often it changes?

1
  • Don't parse ifconfig - it's meant for human consumption. Use something like ip link instead. Feb 22, 2018 at 18:10

1 Answer 1

4

On many distros ifconfig is deprecated and replaced by the ip command. On my Centos7.4 ifconfig --version says net-tools 2.10-alpha while on my Ubuntu 16.04 it says net-tools 1.60 / ifconfig 1.42 (2001-04-13).

You can usually get the source for a package by installing {package}-src or some such with the distro's package manager.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .