Hi, just have a look here : http://phili.pe/posts/postgresql-on-the-command-line/
How to backup a Postgres DB?
mysqldump -u user -p DB > dump.sql
Import a DB from the Linux command line? mysql -u user -p DB < dump.sql
How to run a command directly from a shell script? mysql -u [user] -p[pass] -e "[mysql commands]"
When managing systems, this stuff is more important to me than the actual Postgres syntax.In short:
pg_dump -Fc mydb > db.dump
Restore: http://www.postgresql.org/docs/current/static/app-pgrestore....In short:
pg_restore -C -d postgres db.dump
Command directly from the shell: psql -c "psql command"pg_dump -C mydb | psql -h ${some_other_server} mydb