how to dump all the data in database to .sql file postgresql on ubuntu code example Example: how to take database dump in postgresql pg_dump dbname > outfile