eth-tool summary of eth# devices

for M in 0 1 2 3 ; do echo eth$M ;/sbin/ethtool eth$M | grep -E "Link|Speed" ; done
Give the Speed and Link status of eth# 0-3. This is sort of what mii-tool does, but eth-tool is better, yet lacks device discovery.
Sample Output
eth0
        Speed: Unknown! (65535)
        Link detected: no
eth1
        Speed: Unknown! (65535)
        Link detected: no
eth2
        Speed: 1000Mb/s
        Link detected: yes
eth3
        Speed: Unknown! (65535)
        Link detected: no

6
By: Wubby
2009-04-22 19:32:41

These Might Interest You

What Others Think

The loop could also be for M in {0..3}
roebek · 477 weeks and 4 days ago
This one's better, as it asks the system what devices it has: for i in `ls --color=none /sys/class/net`; do echo "# $i"; sudo ethtool $i | grep -E "Link|Speed" ; done
hank · 477 weeks and 4 days ago
If you're going to go the sysfs route, might as well drink the coolaid. for I in /sys/class/net/eth* ; do printf "%s\t%5d\n" ${I##*/} $(cat ${I}/speed 2>/dev/null) ; done
parasense · 362 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: