How to view saved WiFi passwords in ubuntu Linux
  John   |     23 May 2023

How to view saved WiFi passwords in ubuntu Linux

When connecting to a password-protected WiFi network for the very first time, you are required to know the password in order to log in to the network.

Once connected, your device saves the WiFi password. In the subsequent times you get into proximity of that WiFi, your device will connect to it automatically without asking you for the password again.

However, if you have an extra device that has never been connected to that WiFi before, you will be prompted to enter the password to connect. You could also be in the company of another person who has never been connected to that WiFi before. In that case, he/she will be required to use the password too to connect to the network.

If it has been some time since you first connected to that WiFi, you are likely to have forgotten it. In this article, I will show you how to find/retrieve a saved password of a WiFi that your Ubuntu Linux PC has been connected to before.

There are two main ways you can do this:

  • Through a Graphical User Interface (GUI)
  • Through Terminal commands

Getting the WiFi password through a Graphical User Interface (GUI)

Step 1: Open the Settings. To do this, simply press the Super (Windows) key on your keyboard then type "settings" in the search bar.

Opening Ubuntu settings

Step 2: Open the WiFi tab in the left column. Then under the "Visible Networks", click on the Settings (gear) icon of the WiFi whose password you want to view.

Opening a WiFi settings in Ubuntu

Step 3: A new window with some information about the WiFi network opens. Click on the "Security" tab.

Ubuntu WiFi settings details

Step 4: Tick on the "Show password" checkbox to reveal the password.

Show WiFi password in Ubuntu

Getting the WiFi password through Terminal commands

Method 1

This method uses a one-line command to get the details of the currently connected WiFi network. It works on all the Linux distros that use network-manager.

Open the terminal (Ctrl + Alt + T) then type the command below.

nmcli device wifi show-password

This command will output the WiFi name, security type, and WiFi password as in the screenshot below.

Checking WiFi password in Ubuntu using terminal

Method 2

Step 1: Open the Linux terminal and run the cd command below to navigate to the directory with the network connection details.

cd /etc/NetworkManager/system-connections/

Opening system-connections in Ubuntu terminal

Step 2: Now run the ls command below to list down all the saved networks on your Ubuntu Linux.

ls -a

Listing all saved networks in Ubuntu terminal

Step 3: Now use the cat command followed by the name of the network whose password you want to check. This name should be as it appears in the ls command output above. The command outputs the WiFi network's details, inclusive of its password.

sudo cat [network name]

The password can be found prefixed by “psk=” under the WiFi-Security section.

Details about a saved network in Ubuntu terminal

Note: If the network name contains spaces, it must be enclosed within quotes in the cat command. The network file is owned by the root, so you must use sudo in the cat command.

That's it!

Now you can comfortably check the saved WiFi passwords in your Ubuntu Linux PC using any of the above methods.