Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Which of the Commands delete the files from the /tmp directory, issued by non-root user?

1067


What is the syntax of mkdir?

1078


What does free command do in linux?

1094


What would be the result of issuing the command cat phonenos?

1025


What is s in permission linux?

1046


What is mkdir m in linux?

1021


What is Syntax of any Linux command?

1165


How do I find cpu in linux?

990


What is the difference between rmdir and rm r?

1138


What is make in linux?

983


What are grep commands?

1033


What are the 4 kinds of sentences with examples?

1011


How do I check my disk space?

962


Where can I find bash in linux?

987


What does curl command do in linux?

1052