Ever needed to connect a new device to your home WiFi, but you’ve forgotten the password? If you’re running Linux, you’re in luck — your machine already stores the password in a configuration file. With a few terminal commands, you can recover it in seconds. This guide is for anyone with a Linux desktop or laptop who has access to the root account or sudo. No extra software needed. By the end, you’ll know how to pull the WiFi password from NetworkManager or wpa_supplicant using the command line.
Whether you’re a seasoned sysadmin or a curious beginner, these steps are safe and straightforward. We’ll cover the two most common network managers: NetworkManager (used by Ubuntu, Fedora, and most distros) and wpa_supplicant (common on Arch, Kali, and minimal setups). For a complete overview of various methods, check out our comprehensive wifi password recovery tutorial linux guide.
What You’ll Need
- A Linux computer with a saved WiFi network (you need to have connected at least once).
- Sudo or root access. If you don’t have the root password, you won’t be able to read the password files.
- A terminal emulator (GNOME Terminal, Konsole, xterm, etc.).
- Optional: a USB drive if you want to save the password to a file.
If you haven’t already set up your system for recovery, check the wifi password recovery setup guide to ensure your network manager stores passwords in the usual location.
Step 1: Check Your Network Manager
First, find out which network manager is running. Open a terminal and type:
systemctl status NetworkManager
Most desktop distros
If you see ‘active (running)’, you have NetworkManager. On Arch or Kali, you might see ‘systemctl status NetworkManager’ fail. Try instead:
systemctl status wpa_supplicant
Alternative for minimal setups
Knowing your manager determines the next step. For Kali-specific instructions, see our wifi password recovery for kali linux laptop post.

Step 2: Retrieve Password from NetworkManager
If you’re using NetworkManager, the password is stored in the connection file. List your saved connections with:
nmcli connection show
List all connections
You’ll see a list like ‘WiFi_SSID’ in the NAME column. To get the password for a specific connection, use:
sudo nmcli -s connection show “WiFi_SSID” | grep 802-11-wireless-security.psk
Replace WiFi_SSID with your actual SSID
The output will show ‘802-11-wireless-security.psk: your_password’. If you prefer to avoid the terminal, you can also open the connection file directly:
sudo cat /etc/NetworkManager/system-connections/WiFi_SSID.nmconnection
Direct file access
Search for the line ‘psk=’ followed by the password. For more graphical methods, check our how to recover wifi password without internet article — but this command works offline.

Step 3: Retrieve Password from wpa_supplicant.conf
If your system uses wpa_supplicant (common on Kali or Arch), the password is in /etc/wpa_supplicant/wpa_supplicant.conf or a per-interface file like /etc/wpa_supplicant/wlan0.conf. Open it with:
sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
Example file path
Look for a network block with your SSID. The password is in the ‘psk’ field — if it’s a hash, you’ll see a long hex string; if it’s in plaintext, it will be in quotes. For example:
network={
ssid=”MyWiFi”
psk=”my_plain_password”
}Plaintext example
If you see a hash, you can still use it as the password (most routers accept the hash). For troubleshooting, our wifi password recovery setup guide explains how to interpret hashed passwords.

Step 4: One-Liner with grep (Works for Both)
If you want a quick one-liner that works for both NetworkManager and wpa_supplicant (provided you know where the files are), use:
sudo grep -r ‘psk=’ /etc/NetworkManager/system-connections/ /etc/wpa_supplicant/
Searches both directories
This will find any line containing ‘psk=’ and print it with the filename. Perfect for recovering multiple passwords at once.

Step 5: Retrieve Password for a Specific SSID
If you know the exact SSID, you can filter with awk or sed. For NetworkManager:
sudo awk -F= ‘/^psk=/ {print $2}’ /etc/NetworkManager/system-connections/YourSSID.nmconnection
Replace YourSSID with actual SSID
For wpa_supplicant, use:
sudo awk ‘/ssid=”YourSSID”/{getline; print}’ /etc/wpa_supplicant/wpa_supplicant.conf
Extracts psk line after the SSID
This is especially handy when you have many saved networks.

Common Pitfalls
- Not using sudo: Most password files are readable only by root. If you forget sudo, you’ll get ‘Permission denied’.
- Wrong network manager: If you’re on a distro that uses wpa_supplicant but try the NetworkManager method, you’ll find no files. Always check which service is active first.
- Hash instead of plaintext: Some wpa_supplicant configurations store the password as a hexadecimal hash. While it’s technically the same password, you can’t type the hash directly — you need to use the original password or convert it. For help, see our wifi password recovery setup guide.
Where to Next
Now you can recover any saved WiFi password on Linux with a few commands. If you need to recover passwords on other platforms, check out our guides for Windows (view saved wifi password using cmd) and macOS. If you’re using Kali Linux frequently, our wifi password recovery for kali linux laptop post covers additional tools like aircrack-ng for pentesting. Happy recovering!