리눅스 이더넷 장치명 뽑기

gathering ethernet device names in linux
리눅스 이더넷 장치명 목록 확인

1 netstat[ | ]

1.1 목록 보기[ | ]

[root@zetawiki ~]# netstat -ain | grep eth
eth0       1500   0        0      0      0      0        0      0      0      0 BM
eth1       1500   0        0      0      0      0        0      0      0      0 BM
eth2       1500   0        0      0      0      0        0      0      0      0 BM
eth3       1500   0        0      0      0      0        0      0      0      0 BM
eth4       9000   0 1817580326      0      0      0 1734983418      0      0      0 BMsRU
eth5       1500   0        0      0      0      0        0      0      0      0 BMU
eth6       9000   0   968740      0      0      0        0      0      0      0 BMsRU
eth7       1500   0 902941906      0      0      0 455988412      0      0      0 BMRU
eth8       1500   0 462123140      0      0      0 692422784      0      0      0 BMsRU
eth9       1500   0 1037464109      0      0      0 692423228      0      0      0 BMsRU
eth10      1500   0 463173821      0      0      0 692419632      0      0      0 BMsRU
eth11      1500   0 1036394616      0      0      0 692424467      0      0      0 BMsRU

1.2 장치명만 뽑기[ | ]

[root@zetawiki ~]# netstat -ain | grep eth | awk '{print $1}'
eth0
eth1
eth2
eth3
eth4
eth5
eth6
eth7
eth8
eth9
eth10
eth11

1.3 배열에 담기[ | ]

명령어
DEVNAMES=(`ifconfig -a | grep eth | awk '{print $1}' | xargs echo`)
echo ${DEVNAMES[@]}
실행예시
[root@zetawiki ~]# DEVNAMES=(`ifconfig -a | grep eth | awk '{print $1}' | xargs echo`)
[root@zetawiki ~]# echo ${DEVNAMES[@]}
eth0 eth1 eth2 eth3 eth4 eth5 eth6 eth7 eth8 eth9 eth10 eth11

2 ifconfig[ | ]

2.1 목록 보기[ | ]

[root@zetawiki ~]# ifconfig -a | grep eth 
eth0      Link encap:Ethernet  HWaddr 71:23:45:0B:3D:90  
eth1      Link encap:Ethernet  HWaddr 71:23:45:0B:3D:91  
eth2      Link encap:Ethernet  HWaddr 71:23:45:0B:3D:92  
eth3      Link encap:Ethernet  HWaddr 71:23:45:0B:3D:93  
eth4      Link encap:Ethernet  HWaddr DE:F0:64:30:F1:28  
eth5      Link encap:Ethernet  HWaddr DE:F0:64:30:F1:2C  
eth6      Link encap:Ethernet  HWaddr DE:F0:64:30:F1:28  
eth7      Link encap:Ethernet  HWaddr DE:F0:64:30:72:5C  
eth8      Link encap:Ethernet  HWaddr 00:44:55:E7:D0:74  
eth9      Link encap:Ethernet  HWaddr 00:44:55:E7:D0:74  
eth10     Link encap:Ethernet  HWaddr 00:44:55:E7:D0:74  
eth11     Link encap:Ethernet  HWaddr 00:44:55:E7:D0:74

2.2 장치명만 뽑기[ | ]

[root@zetawiki ~]# ifconfig -a | grep eth | awk '{print $1}'
eth0
eth1
eth2
eth3
eth4
eth5
eth6
eth7
eth8
eth9
eth10
eth11

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}