This happens to me many times: I setup strong Wi-Fi passwords for security reasons, write it down in my local machine or physically on paper so in need I just copy from. Then after few months I use to forget even the location where I save the password. 🙂
Fortunately, there is a way to find forgotten Wi-Fi passwords in Ubuntu. When you connect to a wireless network (or any network) and set the "connect automatically" option, Ubuntu network manager saves the password along with network settings
There are two ways to see the Wi-Fi passwords in Ubuntu : GUI and command line way.
Find saved wifi password in Ubuntu : GUI way
Find saved Wi-Fi password using GUI is the simplest and preferred way for non-techie GUI friendly users. Launch Settings from Gnome applications menu.
On left side menu in Wi-Fi tab, you will find the list of available Wi-Fi networks and the ones you've connected to in the past. Click on the gear icon in front of the saved Wi-Fi network whose password you want to find. Gear icon will only be visible to networks you have once connected. In the Security tab check the Show Password button to reveal the password.
Find saved wifi password in Ubuntu : Command line way
Ubuntu uses Network Manager to handle network related settings. For each connection you have connected in the past, network manager saves the details of the connection as a file in the /etc/NetworkManager/system-connections/ directory.
sudo cat /etc/NetworkManager/system-connections/<WiFi_Network_Name>.nmconnection
The password for the network connection can be found under the [wifi-security] section, in the line that starts with psk.
That's easy, right?