Ubuntu saves the password when you use “connect automatically” while connecting to a wireless network using WEP, WPA or WPA2-PSK. Sometimes you may forget the password of the wifi network. No worries, Ubuntu saves wifi network informations under “Network Manager” directory. We can access the directory and view the config file which contains configuration details of the wifi network.
To find the saved wifi password via command line, follow these steps: Login into Ubuntu and open up the “Terminal” and enter these commands.
$ cd /etc/NetworkManager/system-connections/ $ ls -a
Now you will get name of the wifi networks saved on your pc. Now enter the following command with the name of your wifi network you want to find the password. You can find your password at “psk”=“PASSWORD”.
$ sudo cat WIFI_SSID_Name