How to find the saved Wifi Password in Ubuntu

I connected my laptop with my home Wifi connection but now I forget the password and I want to login on my mobile device as well. Can you tell me how can I check my saved password so that I can use it on my mobile? Or do I need to change the Wifi Password by accessing the router's settings?


Open up a terminal ( Ctrl+Alt+t ) then issue:

cd /etc/NetworkManager/system-connections
ls -la 

Now just cat out whichever file matches the connection you need to view:

sudo cat 'my_cool_network'   #  you MUST use sudo as file is root owned ... quote if file name contains spaces

In output look for something like this:

[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=ele55Hroad

As you can see my WiFi password is ele55Hroad

Above works on Ubuntu 18.10+


One-liner

A one-liner you can use:

sudo grep --with-filename psk= /etc/NetworkManager/system-connections/*

For example:

$ sudo grep --with-filename psk= /etc/NetworkManager/system-connections/*

/etc/NetworkManager/system-connections/SHAW-999999:psk=99999A999999
/etc/NetworkManager/system-connections/SHAW-999999-5G:psk=99999A999999
/etc/NetworkManager/system-connections/SHAW-999999-5G:psk=999999999999

After "system-connections/" you will see your WiFi network name. EG "SHAW-999999". Then you will see your password after ":psk=". EG "99999A999999". WiFi network name and password were redacted in case my neighbour is hoping for a free bus ride :)