pg_dump and pg_dumpall tools backup create zero size backup file from linux putty terminal I have installed postgres database version 9.6, 10 on OS Centos 7 64 bit. I'm trying to take a backup with this command:



-bash-4.2$ pg_dump -h localhost -Fc backupdb &gt; /var/lib/pgsql/niger_pgbackup/nigerpg_bkp.sql


but the problem is the backup file size is zero. I have tried many times. Kindly help  where I have gone wrong.



-bash-4.2$ pg_dump -h localhost -Fc backupdb &gt; /var/lib/pgsql/niger_pgbackup/nig erpg_bkp.sql
-bash-4.2$ cd niger_pgbackup/
-bash-4.2$ ls -ltr
total 0
-rwxrwxrwx 1 postgres postgres 0 Oct 7 23:38 nigerpg_bkp.sql
just after being a superuser of the shell, try with supplying superuser postgres as:

    pg_dumpall -f filename.sql -U postgres


or

    pg_dumpall -U postgres &gt; filename.sql


you do not need $bash-rc, just be superuser and run the commands, more info is here