I want to see how many interfaces(ethernet cards) are
working using single command?
Answer Posted / alf55
The command:
ifconfig -a | (grep -E 'Link encap:|inet6 addr|inet addr:' |
grep -vE 'inet addr:|inet6 addr')
Would result with an output similar to:
eth0 Link encap:Ethernet HWaddr 00:90:f5:b7:6a:1c
lo Link encap:Local Loopback
sit0 Link encap:IPv6-in-IPv4
wlan0 Link encap:Ethernet HWaddr 00:24:d7:a7:16:c0
So the command:
ifconfig -a | (grep -E 'Link encap:|inet6 addr|inet addr:' |
grep -vE 'inet addr:|inet6 addr') | wc -l
would produce the count.
The problem here is that it would also count usages such as
"eth0:0".
To not count those devices use:
ifconfig -a | (grep -E 'Link encap:|inet6 addr|inet addr:' |
grep -vE 'inet addr:|inet6 addr:|:[0-9][0-9]*') |wc -l
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How do I remove a soft link in linux?
How find ip address linux?
What is tty name?
What is parallel ssh?
Brief about the command ff?
What does grep command do?
Which commands are used to set a processor-intensive job to use less cpu time?
You wish to print a file ‘draft’ with 60 lines on a page. What command would you use?
What is history command in linux?
What is tail command in linux?
What is the root directory linux?
Explain about sh?
State and explain about features of UNIX?
What is the difference between cd and cd in linux?
How do I search bash history?