Ben L
Ben L

Reputation: 97

PostgreSQL DB dump location

I want to download dumped PostgreSQL databases from an Ubuntu 16.04 server.

sudo su - postgres
pg_dump my_db > backup_db

Search for the path yields the following:

ps auxw |  grep postgres | grep -- -D
postgres  7311  0.0  0.0 293332  3384 ?        S    Mai04   0:39 /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf

Yet I cannot find the dumped files there. What is the location of the dumped files?

Upvotes: 1

Views: 6308

Answers (1)

Vao Tsun
Vao Tsun

Reputation: 51446

$HOME of user postgres

pg_dump just echoes to stdout, unless you specify -f

-f file --file=file

Send output to the specified file. This parameter can be omitted for file based output formats, in which case the standard output is used. It must be given for the directory output format however, where it specifies the target directory instead of a file. In this case the directory is created by pg_dump and must not exist before.

(formatting mine)

so in your case file backup_db will be in same directory where you were running pg_dump my_db > backup_db

next time try specifying full path to know exact location

Upvotes: 1

Related Questions