Import SQL to PostgreSQL via commandline

To import a SQL file into an existing PostgreSQL database do this:

 

 $ psql <databasename> <db-user> -f <name-of-sql>.sql

e.g

 $ psql polldb michael -f ../../../../Downloads/poll-backup.sql