In this article we will show you how to list all databases and tables in PostgreSQL. First of all login to PostgreSQL using psql command and run following command from PostgreSQL command prompt.
To list databases in PostgreSQL you can use any one of below commands:
postgres=# \list postgres=# \l
To list tables of any database, connect to that database and then view tables in that database. First command will connect you with database for which you want to see tables and second command will list tables.
postgres=# \connect mydb mydb=# \dt