-e runs the statement and exits, so it slots into scripts. SHOW DATABASES lists every database you can see, like psql's \l. Related: SHOW TABLES inside a database.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.