linux - 如何削减 ifconfig 以单独获取 eth* 详细信息?

标签 linux bash grep ifconfig

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

示例输出应该来自 ifconfig 之类的,

eth0
eth1
eth2

我试过使用下面的命令,

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

但无法达到同样的效果。

实际上,我需要获取这些eth*并传入

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

为了获得结果 :-) 你能帮我从 ifconfig 中获取裁剪吗? ?

最佳答案

没有。

$ awk -F: '$1 ~ "eth" { print $1 }' /proc/net/dev
  eth0

关于linux - 如何削减 ifconfig 以单独获取 eth* 详细信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12664473/

相关文章:

linux - 从命令提示符更新 Python 版本以及从 PyQt4 到 PyQt5 的转换

bash - 随着时间的推移通过管道发送数据(TOP、SED)

linux - 当我尝试使用 sh `echo ' rm -rf 中的 bash 时出现语法错误!(食谱 )' | bash`

bash - pgrep -P,但对于孙子不仅仅是 child

c - inotify API 与选择

linux - 即使将其目录添加到 "PATH"变量,也无法从某些目录执行 Shell 脚本

linux - 为什么两次使用 grep 时没有显示输出?

grep - 如何grep在特定模式上方和下方的线条

java - 从 java 程序运行 "rsync"的 link_stat 错误

bash - 压缩包 : stdout: File too large when running customized backup script