#1: Display the WiFi Password on Mac OS X Using CLI
You can use the security command. It is a command line interface to keychains and Security framework which stores your WiFI password and other information. Open the Terminal app and type the following command:
security find-generic-password -ga YOUR-ACCOUNT-NAME
security find-generic-password -ga SSID-HERE
security find-generic-password -ga YOUR-WiFi-Access-Point-Name-Here
In this example, find the Wifi password for Iphone4s access point (SSID):
security find-generic-password -ga Iphone4s | grep -i password
security find-generic-password -ga Iphone4s
#2: Not a Fan of Command Line Tools?
The System Keychain is a utility which securely stores all passwords and user IDs for a user and lets that user unlock them all with a single master password.
System Keychain Location
◾Open Spotlight to start a search by pressing Command (⌘)-Space bar
◾In the search field type: keychain access
Try this for Linux / Ubuntu
cat /etc/NetworkManager/system-connections/ | grep psk
security find-generic-password -ga Iphone4s | grep -i password
security find-generic-password -ga Iphone4s
#2: Not a Fan of Command Line Tools?
The System Keychain is a utility which securely stores all passwords and user IDs for a user and lets that user unlock them all with a single master password.
System Keychain Location
◾Open Spotlight to start a search by pressing Command (⌘)-Space bar
◾In the search field type: keychain access
Try this for Linux / Ubuntu
cat /etc/NetworkManager/system-connections/ | grep psk