To overcome differences in format of ifconfig Ubuntu16.04 and Ubuntu17.01
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Background:
I am checking the list available interfaces on Linux using the ifconfig command.
However there is a difference in the format of the output of ifconfig in ubuntu 16.04 and ubuntu 17.10.
On checking further , the net-tools package has been upgraded (from net-tools 1.60 TO net-tools 2.10-alpha)in the ubuntu17.10 and the latest ifconfig outputs the network interface names with a colon (':').
On older version :
$ ifconfig --version
net-tools 1.60 ifconfig 1.42 (2001-04-13)
$ ifconfig
enp0s3 Link encap:Ethernet
On the newer version
$ ifconfig --version net-tools 2.10-alpha
$ifconfig
ens160: flags=4163 mtu 1500
lo: flags=73 mtu 65536
This can break some tools which does take into account or expect the extra ':' in the output.
Question:
Is there a way to obtain the list of network interface in a reliable way, such that any change in the format of ifconfig output does not affect tools using it ? Is there alternative for ifconfig that can be used in consistent manner?
network-interface
add a comment |Â
up vote
1
down vote
favorite
Background:
I am checking the list available interfaces on Linux using the ifconfig command.
However there is a difference in the format of the output of ifconfig in ubuntu 16.04 and ubuntu 17.10.
On checking further , the net-tools package has been upgraded (from net-tools 1.60 TO net-tools 2.10-alpha)in the ubuntu17.10 and the latest ifconfig outputs the network interface names with a colon (':').
On older version :
$ ifconfig --version
net-tools 1.60 ifconfig 1.42 (2001-04-13)
$ ifconfig
enp0s3 Link encap:Ethernet
On the newer version
$ ifconfig --version net-tools 2.10-alpha
$ifconfig
ens160: flags=4163 mtu 1500
lo: flags=73 mtu 65536
This can break some tools which does take into account or expect the extra ':' in the output.
Question:
Is there a way to obtain the list of network interface in a reliable way, such that any change in the format of ifconfig output does not affect tools using it ? Is there alternative for ifconfig that can be used in consistent manner?
network-interface
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Background:
I am checking the list available interfaces on Linux using the ifconfig command.
However there is a difference in the format of the output of ifconfig in ubuntu 16.04 and ubuntu 17.10.
On checking further , the net-tools package has been upgraded (from net-tools 1.60 TO net-tools 2.10-alpha)in the ubuntu17.10 and the latest ifconfig outputs the network interface names with a colon (':').
On older version :
$ ifconfig --version
net-tools 1.60 ifconfig 1.42 (2001-04-13)
$ ifconfig
enp0s3 Link encap:Ethernet
On the newer version
$ ifconfig --version net-tools 2.10-alpha
$ifconfig
ens160: flags=4163 mtu 1500
lo: flags=73 mtu 65536
This can break some tools which does take into account or expect the extra ':' in the output.
Question:
Is there a way to obtain the list of network interface in a reliable way, such that any change in the format of ifconfig output does not affect tools using it ? Is there alternative for ifconfig that can be used in consistent manner?
network-interface
Background:
I am checking the list available interfaces on Linux using the ifconfig command.
However there is a difference in the format of the output of ifconfig in ubuntu 16.04 and ubuntu 17.10.
On checking further , the net-tools package has been upgraded (from net-tools 1.60 TO net-tools 2.10-alpha)in the ubuntu17.10 and the latest ifconfig outputs the network interface names with a colon (':').
On older version :
$ ifconfig --version
net-tools 1.60 ifconfig 1.42 (2001-04-13)
$ ifconfig
enp0s3 Link encap:Ethernet
On the newer version
$ ifconfig --version net-tools 2.10-alpha
$ifconfig
ens160: flags=4163 mtu 1500
lo: flags=73 mtu 65536
This can break some tools which does take into account or expect the extra ':' in the output.
Question:
Is there a way to obtain the list of network interface in a reliable way, such that any change in the format of ifconfig output does not affect tools using it ? Is there alternative for ifconfig that can be used in consistent manner?
network-interface
asked Nov 29 '17 at 4:01
Sudarshan Srinivasan
82
82
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
The net-tools package was deprecated for some time, being replaced by iproute2 (ip
being the primary tool in that package). Many distributions no longer even ship net-tools as part of their base install.
Development of net-tools has since restarted, but this has resulted in a number of the tools being enhanced in compatibility breaking ways, as you've seen with ifconfig
. From NEWS.Debian.gz
on a Debian 9.0 system:
After 15 years without upstream development, net-tools is being worked on again, fixing many long-standing issues.
The bad news is that the output of many commands has changed, and it is sure to break scripts that relied on parsing it.
For that reason it may be an idea to adapt your scripts to use the iproute2 tools. For example, ip link
should give you similar information to your bare ifconfig
above. The one downside to this approach is that it breaks compatibility with non-Linux systems, almost all of which use ifconfig
.
Thanks iproute2 looks to be supported on most the distributions and embedded distros (via busybox)
â Sudarshan Srinivasan
Feb 17 at 9:38
add a comment |Â
up vote
1
down vote
An alternative way to list all interfaces in Linux from shell is reading /proc/net/dev
, which have a more stable format than the output of ifconfig(8) from net-tools
.
For example, to get name of interfaces:
whr@debianjessie:~$ sed -r -e 1,2d -e 's/^ +//' -e 's/: .+//' /proc/net/dev
ppp0
lo
eth0
eth1
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The net-tools package was deprecated for some time, being replaced by iproute2 (ip
being the primary tool in that package). Many distributions no longer even ship net-tools as part of their base install.
Development of net-tools has since restarted, but this has resulted in a number of the tools being enhanced in compatibility breaking ways, as you've seen with ifconfig
. From NEWS.Debian.gz
on a Debian 9.0 system:
After 15 years without upstream development, net-tools is being worked on again, fixing many long-standing issues.
The bad news is that the output of many commands has changed, and it is sure to break scripts that relied on parsing it.
For that reason it may be an idea to adapt your scripts to use the iproute2 tools. For example, ip link
should give you similar information to your bare ifconfig
above. The one downside to this approach is that it breaks compatibility with non-Linux systems, almost all of which use ifconfig
.
Thanks iproute2 looks to be supported on most the distributions and embedded distros (via busybox)
â Sudarshan Srinivasan
Feb 17 at 9:38
add a comment |Â
up vote
2
down vote
accepted
The net-tools package was deprecated for some time, being replaced by iproute2 (ip
being the primary tool in that package). Many distributions no longer even ship net-tools as part of their base install.
Development of net-tools has since restarted, but this has resulted in a number of the tools being enhanced in compatibility breaking ways, as you've seen with ifconfig
. From NEWS.Debian.gz
on a Debian 9.0 system:
After 15 years without upstream development, net-tools is being worked on again, fixing many long-standing issues.
The bad news is that the output of many commands has changed, and it is sure to break scripts that relied on parsing it.
For that reason it may be an idea to adapt your scripts to use the iproute2 tools. For example, ip link
should give you similar information to your bare ifconfig
above. The one downside to this approach is that it breaks compatibility with non-Linux systems, almost all of which use ifconfig
.
Thanks iproute2 looks to be supported on most the distributions and embedded distros (via busybox)
â Sudarshan Srinivasan
Feb 17 at 9:38
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The net-tools package was deprecated for some time, being replaced by iproute2 (ip
being the primary tool in that package). Many distributions no longer even ship net-tools as part of their base install.
Development of net-tools has since restarted, but this has resulted in a number of the tools being enhanced in compatibility breaking ways, as you've seen with ifconfig
. From NEWS.Debian.gz
on a Debian 9.0 system:
After 15 years without upstream development, net-tools is being worked on again, fixing many long-standing issues.
The bad news is that the output of many commands has changed, and it is sure to break scripts that relied on parsing it.
For that reason it may be an idea to adapt your scripts to use the iproute2 tools. For example, ip link
should give you similar information to your bare ifconfig
above. The one downside to this approach is that it breaks compatibility with non-Linux systems, almost all of which use ifconfig
.
The net-tools package was deprecated for some time, being replaced by iproute2 (ip
being the primary tool in that package). Many distributions no longer even ship net-tools as part of their base install.
Development of net-tools has since restarted, but this has resulted in a number of the tools being enhanced in compatibility breaking ways, as you've seen with ifconfig
. From NEWS.Debian.gz
on a Debian 9.0 system:
After 15 years without upstream development, net-tools is being worked on again, fixing many long-standing issues.
The bad news is that the output of many commands has changed, and it is sure to break scripts that relied on parsing it.
For that reason it may be an idea to adapt your scripts to use the iproute2 tools. For example, ip link
should give you similar information to your bare ifconfig
above. The one downside to this approach is that it breaks compatibility with non-Linux systems, almost all of which use ifconfig
.
edited Nov 29 '17 at 10:49
answered Nov 29 '17 at 9:13
mjturner
3,8781224
3,8781224
Thanks iproute2 looks to be supported on most the distributions and embedded distros (via busybox)
â Sudarshan Srinivasan
Feb 17 at 9:38
add a comment |Â
Thanks iproute2 looks to be supported on most the distributions and embedded distros (via busybox)
â Sudarshan Srinivasan
Feb 17 at 9:38
Thanks iproute2 looks to be supported on most the distributions and embedded distros (via busybox)
â Sudarshan Srinivasan
Feb 17 at 9:38
Thanks iproute2 looks to be supported on most the distributions and embedded distros (via busybox)
â Sudarshan Srinivasan
Feb 17 at 9:38
add a comment |Â
up vote
1
down vote
An alternative way to list all interfaces in Linux from shell is reading /proc/net/dev
, which have a more stable format than the output of ifconfig(8) from net-tools
.
For example, to get name of interfaces:
whr@debianjessie:~$ sed -r -e 1,2d -e 's/^ +//' -e 's/: .+//' /proc/net/dev
ppp0
lo
eth0
eth1
add a comment |Â
up vote
1
down vote
An alternative way to list all interfaces in Linux from shell is reading /proc/net/dev
, which have a more stable format than the output of ifconfig(8) from net-tools
.
For example, to get name of interfaces:
whr@debianjessie:~$ sed -r -e 1,2d -e 's/^ +//' -e 's/: .+//' /proc/net/dev
ppp0
lo
eth0
eth1
add a comment |Â
up vote
1
down vote
up vote
1
down vote
An alternative way to list all interfaces in Linux from shell is reading /proc/net/dev
, which have a more stable format than the output of ifconfig(8) from net-tools
.
For example, to get name of interfaces:
whr@debianjessie:~$ sed -r -e 1,2d -e 's/^ +//' -e 's/: .+//' /proc/net/dev
ppp0
lo
eth0
eth1
An alternative way to list all interfaces in Linux from shell is reading /proc/net/dev
, which have a more stable format than the output of ifconfig(8) from net-tools
.
For example, to get name of interfaces:
whr@debianjessie:~$ sed -r -e 1,2d -e 's/^ +//' -e 's/: .+//' /proc/net/dev
ppp0
lo
eth0
eth1
edited Nov 29 '17 at 19:05
GAD3R
22.6k154894
22.6k154894
answered Nov 29 '17 at 17:34
Low power
264
264
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407637%2fto-overcome-differences-in-format-of-ifconfig-ubuntu16-04-and-ubuntu17-01%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password