pg_dump is your friend. When you search for it here in the forum, you’ll find e.g. this thread with a complete command.
pg_dump