Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I see using command-line whether I am connected to network using eth0, eth1 or wln0 etc?

Well, to elaborate, I have a desktop sidebar which I installed using program "conky". This sidebar has meter that shows internet speed. Since I am not using eth0, I need to make a minor change in ~/.conkyrc file. I need to replace "eth0" with whatever network is being used by my wireless card to connect to internet (via a router).

share|improve this question
ifconfig may be what you are looking for. – Marty Fried Jul 23 '12 at 1:11
up vote 2 down vote accepted

You may very well be connected to multiple networks at once, depending on your setup.

If you are interested in knowing which interface is being used for Internet traffic, try using the ip route command and look at the default route. For example, on my system it shows that traffic will travel over eth0 if it isn't matched by any of the other rules in the table:

$ ip route
default via dev eth0  proto static dev eth0  scope link  metric 1000 dev eth0  proto kernel  scope link  src  metric 1 
share|improve this answer
Eureka! It was "eth2". I found it using ifconfig, since I knew my manually configured ip address, it was used by eth2. However, ip route is a better option, since it clearly showed "eth2" to be the one and only network being used. – Chirag Jul 23 '12 at 16:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.