Shell Script
> ifconfig
eth0 Link encap:Ethernet HWaddr 00:a0:d1:78:17:42 inet addr:10.34.119.12 Bcast:10.34.119.255 Mask:255.255.255.0 inet6 addr: fe80::2a0:d1ff:fe78:1742/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:67 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:138 (138.0 B) TX bytes:7103 (6.9 KB) Interrupt:17 eth1 Link encap:Ethernet HWaddr 00:1b:77:2a:11:99 inet6 addr: 2002:db2::21b:77ff:fe2a:1199/64 Scope:Global inet6 addr: fe80::21b:77ff:fe2a:1199/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:281 overruns:0 frame:0 TX packets:10 errors:0 dropped:1 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2057 (2.0 KB) TX bytes:15461 (15.0 KB) Interrupt:16 Base address:0x8000 Memory:f1000000- f1000fff if i wanna cut only eth1 part as shown below, which command should i use? eth1 Link encap:Ethernet HWaddr 00:1b:77:2a:11:99 inet6 addr: 2002:db2::21b:77ff:fe2a:1199/64 Scope:Global inet6 addr: fe80::21b:77ff:fe2a:1199/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:281 overruns:0 frame:0 TX packets:10 errors:0 dropped:1 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2057 (2.0 KB) TX bytes:15461 (15.0 KB) Interrupt:16 Base address:0x8000 Memory:f1000000- f1000fff i've ever use grep but it prints only one line so i dont know how can i get it. Thanks |
ifconfig | grep eth1
This will print all lines containing eth1 |
Unless you're doing some kind of programming project, I would just use the command:
Code:
ifconfig eth1 |
Code:
ifconfig |sed -n -e '/^eth1/,/^$/ p' |
homey: oh yeah... :D
|
Quote:
|
Quote:
Quote:
|
All times are GMT -5. The time now is 02:51 PM. |