0
ip a|grep -v "lo|loopback|127.0.0.1" 这样怎样
gjc159357 发表于 2015-8-17 15:46
太纠结 这个有必要么 你要么就正则 过滤网卡信息好了
ip a|grep -v "lo|loopback|127.0.0.1" 这样怎样
0
你可以 ifconfig -a | grep "eth*"
346115392 发表于 2015-8-17 15:52
ip a|grep -v "lo|loopback|127.0.0.1" 这样怎样
你可以 ifconfig -a | grep "eth*"
0
这个不行呀 会把lo的加在后面 ip a 的时候也不能用
[root@localhost ~]# ip a | grep "eth*"
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
2: eth0: mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:e1:c2:5f brd ff:ff:ff:ff:ff:ff
inet 192.168.137.2/24 brd 192.168.137.255 scope global eth0
inet6 fe80::20c:29ff:fee1:c25f/64 scope link
[root@localhost ~]# ifconfig |grep "eth*"
eth0 Link encap:Ethernet HWaddr 00:0C:29:E1:C2:5F
inet addr:192.168.137.2 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fee1:c25f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:194 errors:0 dropped:0 overruns:0 frame:0
TX packets:141 errors:0 dropped:0 overruns:0 carrier:0
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
[root@localhost ~]#
gjc159357 发表于 2015-8-17 15:55
你可以 ifconfig -a | grep "eth*"
这个不行呀 会把lo的加在后面 ip a 的时候也不能用
[root@localhost ~]# ip a | grep "eth*"
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
2: eth0:
link/ether 00:0c:29:e1:c2:5f brd ff:ff:ff:ff:ff:ff
inet 192.168.137.2/24 brd 192.168.137.255 scope global eth0
inet6 fe80::20c:29ff:fee1:c25f/64 scope link
[root@localhost ~]# ifconfig |grep "eth*"
eth0 Link encap:Ethernet HWaddr 00:0C:29:E1:C2:5F
inet addr:192.168.137.2 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fee1:c25f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:194 errors:0 dropped:0 overruns:0 frame:0
TX packets:141 errors:0 dropped:0 overruns:0 carrier:0
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
[root@localhost ~]#
编辑回复