How to Forget a Saved Wi-Fi Network on Your Raspberry Pi

Learn how to remove a saved wireless network in about a minute.
Zach Zach (248)
5 minutes

This short guide will show you how to delete, or "forget," a saved wireless network from your Raspberry Pi. This is useful for changing networks or troubleshooting connectivity issues.

Raspberry PiRaspberry Pi ×1

Howchoo is reader-supported. As an Amazon Associate, we may earn a small affiliate commission at no cost to you when you buy through our links.

Access the Raspberry Pi terminal using SSH or by connecting a keyboard, mouse, and monitor to your Pi.

Use the following command to access the full list of configured wireless networks:

/etc/wpa_supplicant/wpa_supplicant.conf

You'll be prompted to enter your Raspberry Pi password—the default Raspberry Pi password is raspberrypi. If you haven't already, I highly recommend you change your Raspberry Pi's password after logging in by running the following command:

passwd

To forget a specific Pi wireless network, delete the corresponding network block, surrounded by opening and closing {} curly braces. For example, deleting the following will "forget" the serenity network:

network={
    ssid="serenity"
    psk="shepherdBookHasScaryHair$1"
    key_mgmt=WPA-PSK
}

If you want to forget a network but keep the configuration in place for later, you can uncomment the block instead by adding a # symbol to the beginning of each line. For example, uncommenting the following will "forget" the serenity network while keeping the details in the file for future use:

#network={
#    ssid="serenity"
#    psk="shepherdBookHasScaryHair$1"
#    key_mgmt=WPA-PSK
#}

When you're done, save and exit by pressing CTRL-X, typing Y, and pressing enter.

A recommendation before deleting

Of course, if you're connected to your Pi via the network you want to remove, you'll be disconnected from the Pi as soon as your Pi forgets the network.

Therefore, I recommend adding a new network before deleting the other network—this makes it slightly easier to add your "new" network. If you need to, finding which network your Pi is connected to is easy.

Confirm your edition with a simple command.
Ash Ash (362)
2 minutes

So you've got a machine running Ubuntu. If it's been a while since you set up Ubuntu (or maybe you're just curious), you probably need to check what version you're running.