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.
Open Keychain Access app. It is located in the Applications > Utilities folder.
Select the System keychain in the left menu bar, and select Passwords from the category menu. This will filter the keychains to just your stored passwords