In order to backup your database in PostgreSQL, use the following command:

pg_dump name_of_database > name_of_database.sql

In order to restore your database in PostgreSQL, use the following command:

psql name_of_database < name_of database.sql