There are two ways to list all the available databases. The first is a psql only command:
psql
\list
The second approach is to query the pg_database table. Something like the following will suffice:
pg_database
select datname from pg_database;
Last updated 4 years ago