Forrest logo
back to the pg_dumpall tool

pg_dumpall:tldr:fff02

pg_dumpall: Dump all databases into a custom-format archive file with moderate compression.
$ pg_dumpall -Fc > ${output_file-dump}
try on your machine

This command is used to perform a full database dump of all databases in a PostgreSQL cluster.

Here is the breakdown of the command:

  • pg_dumpall is the command-line utility in PostgreSQL used to create a text or custom-format dump file of the entire database cluster.
  • -Fc is an option used to specify the custom format for the output file. In this case, it specifies that the dump file should be in the custom format rather than plain text.
  • > is a shell operator used for output redirection. It redirects the output of the command to a file instead of displaying it on the screen.
  • ${output_file-dump} is a variable used to specify the name of the output file for the dump. The variable output_file is being used, and if it is not set, the default value will be dump.

Putting it all together, the command pg_dumpall -Fc > ${output_file-dump} creates a custom-format dump of the entire PostgreSQL cluster and saves it to a file with the name defined by the variable output_file, or dump if the variable is not set.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the pg_dumpall tool