1. Overview

In the vast landscape of Linux, users often explore the depths of their operating system, seeking to unveil its secrets. One common task is to reveal the Wi-Fi password of the currently connected network — a handy piece of information stored on our file system. Fortunately, Linux provides the tools and commands to reveal the password without much hassle.

In this tutorial, we’ll explore different methods to find out the Wi-Fi password of the currently connected network.

2. Understanding the Basics of Our Current Wi-Fi Connection

Before diving into the password retrieval methods, it’s essential to understand the basics of our current Wi-Fi connection. For this, we’ll open a terminal and execute the iwconfig command:

$ iwconfig
lo        no wireless extensions.
neweOth0  no wireless extensions.
wlan0     IEEE 802.11  ESSID:"HomeWiFi"  
          Mode:Managed  Frequency:5.18 GHz  Access Point: 65:4F:52:61:39:F2   
          Bit Rate=325 Mb/s   Tx-Power=22 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=47/70  Signal level=-63 dBm  
...

The above command displays information about the currently connected wireless interface, including the ESSID (Extended Service Set Identifier), Bit Rate, MAC, and others.

Let’s make a note of the ESSID since it will be valuable for exploring password retrieval methods later on.

3. CLI Methods for Finding the Current Wi-Fi Password

Let’s explore two command-line methods to find out the password of the currently connected Wi-Fi network.

3.1. Using NetworkManager

Once we identify the network ESSID information, we can retrieve its password by viewing the NetworkManager configuration file. Linux stores network configurations in files within the /etc/ directory and Wi-Fi passwords are often found in the /etc/NetworkManager/system-connections/ directory.

Let’s find out the Wi-Fi password for the currently connected network (HomeWiFi) by using use the cat command to look into the configuration file:

$ sudo cat /etc/NetworkManager/system-connections/HomeWiFi
[connection]
id=HomeWiFi
uuid=855c4983-2432-4cf2-936a-bedbb5ce7b66
type=802-11-wireless
[802-11-wireless]
ssid=HomeWiFi
mode=infrastructure
security=802-11-wireless-security
[802-11-wireless-security]
key-mgmt=wpa-psk
psk=Baeldung@123!
...

The above command shows us the contents of the configuration file, including the Wi-Fi password. In this case, the password is revealed under psk=Baeldung@123!.

3.2. Using nmcli

The nmcli command-line tool is a powerful utility for managing NetworkManager that can provide comprehensive information about the current Wi-Fi connection, including the Wi-Fi password:

$ nmcli device wifi show-password
SSID: HomeWiFi
Security: WPA
Password: Baeldung@123!
  █████████████████████████████████
  ██ ▄▄▄▄▄ █▀ █▀▀██▀▀█▀█ █ ▄▄▄▄▄ ██
  ██ █   █ █▀ ▄ █▀▄▀▀▀  ▀█ █   █ ██
  ██ █▄▄▄█ █▀█ █▄ ▄▀█ ▀▄▀█ █▄▄▄█ ██
  ██▄▄▄▄▄▄▄█▄█▄█ █ █▄█ █▄█▄▄▄▄▄▄▄██
  ██▄  ▄ ▀▄   ▄█▄ ▀▄▄█▀ ▀▄▀▄▀▄▀ ███
  ███▀▄▄█ ▄▄▀ ▀ ▄▄▀ ▄▄ ▀▀  ▄▀▄█▀▀██
  ████▄ ▀ ▄   ▀▄▀▀█▄▄▄▀█▀▀█  ▄ ▀███
  ██  ▄  ▄▄▄▀  █▀ ▄ ██▄█▄ ▄▄█▀▄████
  ██▀█▀▄▀▄▄ ▄▀▀█▄█▄ ▀▄▀ ▀▀▀▄▀ █ ▄██
  ██ █ █▄ ▄ ▀█▄ ▄█▀▄ ██▀ █ ▄ ███▀██
  ██▄█▄██▄▄█ █▄▄▀▀▀▄▀ ▀▀ ▄▄▄ ▄ ████
  ██ ▄▄▄▄▄ █▄█▀█▀ ▄▄▀█▀▀ █▄█ ▀▄█▀██
  ██ █   █ █  ██▄█▄█▀▄▀▀▄▄▄▄  █▀▀██
  ██ █▄▄▄█ █ █▄ ▄█▀  █▀▄▀▄ ▄  ▄ ███
  ██▄▄▄▄▄▄▄█▄▄█▄███▄▄▄█▄████▄▄█████
  █████████████████████████████████

The above command unveils the information about a Wi-Fi network, including its SSID (HomeWiFi), Security (WPA), and Password (Baeldung@123!), along with its QR code.

4. GUI Method for Finding the Current Wi-Fi Password

While the command line in Linux provides a robust environment for power users, not everyone is comfortable navigating through the intricacies of commands and configurations. For those who prefer a more graphical approach, discovering the Wi-Fi password of the currently connected network can be achieved through the Linux graphical user interface (GUI).

First, let’s go to the Advanced Network Configuration:

Advanced Network Configuration Menu in Kali Linux

Similarly, we’ll select HomeWiFi, and on clicking the edit setting, we can go to the Wi-Fi Security tab and check the Show password option to view the password of the currently connected Wi-Fi:

Check Show password in the Wi-Fi Security tab in Kali Linux

Finally, we managed to get the Wi-Fi password in a user-friendly way and can share it with whoever needs it.

5. Conclusion

In this article, we explored both the command-line methods and the GUI method for finding the password of our currently connected Wi-Fi network in Linux.

Whether through efficient command-line tools like NetworkManager and nmcli or the user-friendly graphical interface, Linux provides a versatile and accessible environment for users to reveal the secrets of their Wi-Fi connections. This demystifies the process, highlighting Linux’s flexibility and user-friendly options for accessing essential network information.