I have a fresh install of Ubuntu Server 20.04.1 on a Raspberry Pi 3 B+

I initially set it up connected via WiFi. I now plugged in an ethernet cable but I'm unsure how to tell which is currently the active connection via the command line. I'd prefer to disable the WiFi and have a wired connection.

I'd also like to know how to re-enable WiFi in the future in case I ever disconnect the cable.

I ran ifconfig -a and see the output for both eth0 and wlan0

  • Please edit Your question and add output of the command ifconfig -a. The interface currently being used should have UP,RUNNING in the flags section of the output. Jan 15, 2021 at 0:19
  • Both eth0 and wlan0 show UP,RUNNING in the flags section. Jan 15, 2021 at 0:22
  • Edited to include the ifconfig output Jan 15, 2021 at 0:24
  • Try route command and see which interface is marked as default link. Jan 15, 2021 at 0:28
  • Ahh thanks for that command. It's eth0. I also added an answer for a solution using network-manager. Jan 15, 2021 at 0:31

2 Answers 2


I believe I found a solution. I installed network-manager via apt and ran:

nmcli radio wifi off

And to turn back on:

nmcli radio wifi on
  • This seems to answer your secondary question, not the question's title of how to determine whether ethernet or wifi? Thanks!
    – Matifou
    Aug 25, 2023 at 12:23

Since both wired and WiFi can be connected at the same time, you should ask the system which one it's sending packets through with

ip route

Read man ip ip-route.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .