Command Line and PSQL

PSQL

Below are some basic commands you may use via command line.

2. Start, Stop, or Restart PostgreSQL

service postgresql start | stop | restart


3. Connect to PostgreSQL

$ su - postgres

$ psql

If you set a password for postgres, you will be prompted for it here.

4. Connect to a database

# \c database

5. Install Extension

# \c database

# create extension "hstore";

6. List Tables:

# \c database

# \c database

6. List Tables:

# \c database

# \c database

6. List Tables:

# \c database

# \c database

6. List Tables:

# \c database

# \c database

6. List Tables:

# \c database

# \c database

6. List Tables:

# \c database

# \c database

6. List Tables:

# \c database

# \c database