Do yourself a favor and don't mess directly with the postgresql files. Most of them aren't intended for human interaction and some can be for legacy reasons but are better manipulated via postgres itself. If you do need to do something special, the documentation will tell you.
The createdb program may have a different name depending on which OS distro you are using. I can use it for CentOS, but the problem with generic commands like that is that a lot of systems when you say "createdb", the question is what type of database? I mean, it could be a MySQL or SQLite database. So sometimes distro providers alter the names of utility programs to eliminate ambiguity.
In any event, you can't pg_dump a database that doesn't exist.
But a better solution than createdb is to use the psql command utility and issue the "CREATE DATABASE pg222;" DDL command. That works for most databases, and I just verified that PostgreSQL is included. In fact:
createdb man page wrote:
createdb is a wrapper around the SQL command CREATE DATABASE (CREATE_DATABASE(7)). There is no effective difference between creating databases via this utility and via other methods for
accessing the server.
Note however, that PostgreSQL is very paranoid about security. So if the user that attempts to create the database doesn't have database creation rights, the CREATE DATABASE command will be rejected. This can be avoided by running the psql command under the postgresql administrative userid - which is NOT the same thing as the OS administrative (root) userid. Usually the pg admin userid is something like 'postgres'.
If you do that, however, you'll need to grant rights to the userid who is supposed to actually own the database. The easiest way to to that is by appending the "WITH OWNER = my_user_id" to the CREATE DATABASE command. Use the psql command "\h create database" to see the full set of options.