如何削减ifconfig来单独获得ETH *细节? [英] How to cut ifconfig to get eth* details alone?

查看:185
本文介绍了如何削减ifconfig来单独获得ETH *细节?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个脚本来打印的ethtool使用ifconfig的详细信息。

I'm writing a script to print ethtool details of ifconfig.

样输出应该在ifconfig是喜欢,

Sample output should be from ifconfig is like,

eth0
eth1
eth2

我已经使用下面的命令尝试,

I have tried using below command,

root@bt# ifconfig | cut -d ":" -f 1 

但是可能不能够达到同样的

But could not able to achieve the same.

其实,我需要得到这些 ETH * ,并通过在

Actually, i need to get these eth* and pass in

root@bt# ethtool <arg1> where arg1=eth*

得到的结果:-)可以请你帮我在ifconfig获得收成。 ?

to get results :-) can you please help me to get crop from ifconfig. ?

推荐答案

通过的grep &安培; 使用ifconfig

ifconfig | grep -o '^eth[0-9]\+'

或只的grep

grep -oP '^ *\Keth[0-9]+' /proc/net/dev

这篇关于如何削减ifconfig来单独获得ETH *细节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆