Forrest logo
back to the pg_dump tool

pg_dump:tldr:4119a

pg_dump: Dump a database into a custom-format archive file.
$ pg_dump -Fc ${db_name} > ${output_file-dump}
try on your machine

This command is used to create a backup file of a PostgreSQL database.

Here is how it works:

  1. pg_dump is the command-line utility provided by PostgreSQL for creating database backups. It is used to extract a PostgreSQL database into a script file or other formats.

  2. -Fc is a command-line option for pg_dump which specifies the format of the backup file. In this case, Fc stands for "Custom" format, which is a compressed format that allows for efficient storage and restoration of the database.

  3. ${db_name} is a placeholder for the name of the database you want to back up. You need to replace ${db_name} with the actual name of the database.

  4. > is a shell redirection operator that redirects the output of the command to a specified file instead of the standard output. In this case, the backup data is being redirected to a file.

  5. ${output_file-dump} is a placeholder for the name and location of the output backup file. You need to replace ${output_file-dump} with the desired name and path for your backup file.

The command, when executed, will dump the specified PostgreSQL database in the Custom format and save it as a backup file with the specified name and location.

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_dump tool