How to backup a PostgreSQL database
In the following article you will find a few basic command for backups on PostgreSQL databases.
You can simply dump a database into a SQL file by using pg_dump
pg_dump db_name > /var/backups/db_name.sql
If you want to compress the output you can pipe the stream to gzip and the save it in a file:
pg_dump db_name | gzip > /var/backups/db_name.sql.gz