PSQL

\x auto

You can put this in ~/.psqlrc.

\e

It will open EDITOR and you can enter SQL.

\c

SELECT version();

SELECT current_schema;

\timing

\dv

\dx

\dt

\d table
\d+ table

\df

\du
\du+

\dn

\set

SELECT relname, relpages, reltuples, relallvisible, relkind, relnatts, relhassubclass, reloptions, pg_table_size(oid)
FROM pg_class
WHERE relname='TABLE_NAME'
;

$ psql postgres
Null display is "[NULL]".
Expanded display is used automatically.
psql (12.3)
Type "help" for help.

In the console you can run SQL queries. The prompt is a # pound sign.

[local] hhh@postgres=# select version();
                                                      version
-------------------------------------------------------------------------------------------------------------------
 PostgreSQL 12.3 on x86_64-apple-darwin19.4.0, compiled by Apple clang version 11.0.3 (clang-1103.0.32.59), 64-bit
(1 row)
SELECT * FROM pg_database;

...

CREATE TABLE training (id int primary key);

will create in database’s public schema’s tables.

For example, check number of indexes on table_name:

\d table_name