How to Find Saved Wi-Fi Passwords in Linux

How to Find Saved Wi-Fi Passwords in Linux

You know how frustrating it can be if you’ve ever needed to access a Wi-Fi network but can’t remember the password. Thankfully, if you’re using a Linux computer, there are several ways to view a saved Wi-Fi password.

This tutorial shows you three easy ways to find a saved Wi-Fi password in Linux.

Note: if your Wi-Fi is not working in Linux, we have the fixes here!

Showing Saved Wi-Fi Password Using the Linux Terminal

  1. Open the terminal. You can achieve this by using the CTRL + ALT + T shortcut or your launcher menu.
  1. Navigate to “/etc/NetworkManager/system-connections/”:
cd /etc/NetworkManager/system-connections
System Connections Directory
  1. View the files contained in the directory by running the ls command.
ls -l
Contents Of System Connections Directory

For more tips on using the ls command, check out the most important ls commands you need to know.

Files in this directory contain information on all the wireless networks that your computer has used. Locate the file with the name of the wireless network from which you wish to extract the password.

  1. Using any text editor, open the file with the name of the Wi-Fi from which you wish to know the password.
sudo cat MTE-Test-Wifi.nmconnection
Editing Wifi Configurations

Under the Wi-Fi security section, the Wi-Fi password should be displayed as psk=”password.”

Saved Wifi Password

Alternatively, you can use the grep command to show the password of a connected Wi-Fi password.

sudo grep -r '^psk=' /etc/NetworkManager/system-connections/
Saved Wifi Password Saved Wifi Password 2

If you want to refine the output even more to display only the password, modify the command as follows:

sudo grep -hr '^psk=' /etc/NetworkManager/system-connections/

Good to know: Learn how to control your Wi-Fi network in Linux.

Show Saved Wi-Fi Password Using Nmcli

Nmcli is a tool for controlling the Network Manager through the terminal. It can be used to edit, create, display, delete, deactivate, activate, and delete network connections. You can also use it to display the network device status.

Viewing saved Wi-Fi passwords using nmcli is perhaps the easiest way to view saved passwords. The procedure is as follows:

  1. Launch the Linux terminal.
  2. Run this command to view saved wireless and wired connections.
nmcli -g NAME connection show
Nmcli Connections Show
  1. Now that you have identified the name of the saved Wi-Fi, type in this command. In this illustration, MTE-Test-Wifi is the name of my Wi-Fi network.
nmcli -s -g 802-11-wireless-security.psk connection show MTE-Test-Wifi
Showing Wifi Password Using Nmcli

Note: if your Wi-Fi name has more than one word, remember to enclose it in apostrophes so that the terminal understands that it is a single name.

Good to know: use portmaster to protect your computer and network.

Showing Saved Wi-Fi Password Using Graphical User Interface

If you are not a fan of the Linux terminal, you can also use this GUI method. For this demonstration, we are using the Linux Mint Cinnamon edition.

The following is a step-by-step guide on how to view saved Wi-Fi passwords using GUI:

  1. In the task manager, click on the Network option.
  2. Click on “Network Settings.”
Network Options in Linux desktop

Alternatively, open your launcher menu and search for “Network Settings.” It should open the same settings page.

The page should contain a list of all saved Wi-Fi networks.

Network Settings Page
  1. Click on the settings icon next to the Wi-Fi network in which you wish to extract the password.
Connected Wifi Details Settings

This page displays all the configurations of the related Wi-Fi network.

  1. Under the “Security” tab, check the “Show Password” checkbox.
Wifi Security Settings showing saved password

Your password should be displayed. Click “Cancel” to exit the Settings menu.

Frequently Asked Questions

What is netsh in Linux?

Netsh is a command-line utility that enables a user to, either remotely or locally, display or alter the network configuration of a computer. Netsh also provides a feature that enables a user to run multiple tasks in batch mode. This can be helpful when changing settings on many computers at once.

Netsh is not installed by default on most Linux distros but is available in the repositories of most major distributions.

Can I see saved Wi-Fi paswords without root access?

Yes. While the terminal may require the account password to edit network configuration files, you can use the nmcli command-line utility. Alternatively, you can view the saved Wi-Fi password using the graphical user interface method. 

How do I change my Wi-Fi passwords in Linux? 

Changing a Wi-Fi password in a Linux GUI environment is simple. Open the network manager and update the password in the security tab of the Wi-Fi connection you wish to alter. However, if you have to use the terminal, things may get a little advanced. The easiest way to achieve this is to edit the file containing the Wi-Fi connection configuration details in the “/etc/NetworkManager/system-connections” directory. Open the file and change the psk value in the “Wi-Fi Security” option.

Allan Ngetich
Allan Ngetich

Allan Ngetich is a writer at Make Tech Easier, a website that provides tips, tricks and tutorials on technology. He was born and raised in Kenya, and has always been interested in technology. He started his career as a blog writer, and has since written for several websites. He is a firm believer in hard work and team work, and is always striving to improve his skills.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox