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
Which of the Commands delete the files from the /tmp directory, issued by non-root user?
What is the syntax of mkdir?
What does free command do in linux?
What would be the result of issuing the command cat phonenos?
What is s in permission linux?
What is mkdir m in linux?
What is Syntax of any Linux command?
How do I find cpu in linux?
What is the difference between rmdir and rm r?
What is make in linux?
What are grep commands?
What are the 4 kinds of sentences with examples?
How do I check my disk space?
Where can I find bash in linux?
What does curl command do in linux?