How to see the list of the Postgres databases via the linux terminal?
If you want to execute the command from the shell, you can use the -c option in psql:

psql -c '\l'


Example:

peter@blackrain:~$ sudo su  postgres
postgres@blackrain:/home/peter$ psql -c '\l'
                                  List of databases
    Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
------------+----------+----------+-------------+-------------+-----------------------
 blackrain  | peter    | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | 
 postgres   | postgres | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | 
 redpepper  | peter    | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | 
 template0  | postgres | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres          +
            |          |          |             |             | postgres=CTc/postgres
 template1  | postgres | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres          +
            |          |          |             |             | postgres=CTc/postgres
 x          | peter    | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | 
(6 rows)

postgres@blackrain:/home/peter$