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
What is in mkdir command?
Can I delete .bash history?
What is the fastest way to enter a series of commands from the command-line?
You wish to print the file vacations with 60 lines to a page. Which of the following commands will accomplish this?
What is the syntax of mkdir?
What is the difference between command ‘ping’ and ‘ping6’?
Why bash is used in linux?
How do you copy in linux terminal?
What is the programming language for linux?
Find command can search for files by
When and how linux developed?
What does top do in linux?
How do I clear terminal command history?
What is finger in networking?
What is umask in linux?