Dump a database:

pg_dump [-U ] database-name | gzip > database.gz

Restore a database:

gunzip < database.gz | psql -f - [-U ] database-name