I have connected my Mac to lots of public Wi-Fi networks. I want to know their passwords. What should be the terminal command to list all the Wi-Fi networks whom I connected with in the past with their passwords.
Open Keychain Access from /Applications/Utilities and search for AirPort. All the network passwords are listed as 'AirPort network password' entries. Double-click an entry, then select Show Password and enter your login password to view it.