...
Note that the examples above are very minimalistic. The utilities provided by PostgreSQL offer many options. Check the PostgreSQL documentation on pg_dump, pg_dumpall, pg_restore and pg_sql for detailed information.
Also all be aware that if you have PostgreSQL running on a non-default port (default is 5432) then you need to add -p <portnr> argument.
All the PostgreSQL command-line tools have an extensive help build in. You can access it by using the --help argument.
...