发个系统信息和网络信息获取脚本
Tofloor
poster avatar
RucLinux
deepin
2018-01-10 06:16
Author
这是在之前给一个网友修改的脚本基础上写的脚本,获取的信息也不知道准不准确,因为理解不同,所以可能有些信息的定位也不同。大家可以提提意见。谢谢
脚本源码:http://www.myzhenai.com.cn/post/2842.html
本站原贴:https://bbs.deepin.org/post/149000

以下边的几个文件包来进行实现的。

ifconfig
ethtool
lspci
dmidecode
grep
awk
sed



Reply Favorite View the author
All Replies
avatar
zwq133
deepin
2018-01-10 06:53
#1
好吧,这个收下了,用conky调用一下看看效果!
Reply View the author
avatar
pingpp00
deepin
2018-01-10 17:32
#2
出错了
l@l-PC:~$ sudo ./a.sh
用法: grep [选项]... PATTERN [FILE]...
试用'grep --help' 来获得更多信息。
网络名称:
网卡接口:
ip 地 址:
子网掩码:
默认网关: 10.0.12.1
首选 DNS: 10.10.10.10
MAC 地址:
网卡速率:
Reply View the author
avatar
pingpp00
deepin
2018-01-10 17:33
#3
indx=$(ifconfig -a|grep encap|awk -F " " '{ print $1 }')
这个就不能写死, 每台电脑都不一样的
Reply View the author
avatar
RucLinux
deepin
2018-01-11 15:39
#4
https://bbs.deepin.org/post/151506
出错了
l@l-PC:~$ sudo ./a.sh
用法: grep [选项]... PATTERN [FILE]...

ifconfig
ethtool
lspci
dmidecode
grep
awk
sed

您看一看您的系统中有没有这几个包。
Reply View the author
avatar
RucLinux
deepin
2018-01-11 15:40
#5
https://bbs.deepin.org/post/151506
indx=$(ifconfig -a|grep encap|awk -F " " '{ print $1 }')
这个就不能写死, 每台电脑都不一样的 ...

您用 ifconfig -a 发个完整的信息我看看参考一下,谢谢
Reply View the author
avatar
pingpp00
deepin
2018-01-11 19:48
#6
https://bbs.deepin.org/post/151506
您用 ifconfig -a 发个完整的信息我看看参考一下,谢谢

xu@xu-PC:~$ ifconfig
enp2s0: flags=4163  mtu 1500
        inet 10.0.13.149  netmask 255.255.255.0  broadcast 10.0.13.255
        inet6 fe80::5633:ebd1:b77d:889a  prefixlen 64  scopeid 0x20
        ether 00:16:96:e3:08:d9  txqueuelen 1000  (Ethernet)
        RX packets 169383  bytes 222962268 (212.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 88824  bytes 7114681 (6.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 1  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp3s0: flags=4099  mtu 1500
        ether f4:06:69:16:d4:c9  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Reply View the author