Ever wondered what query hides behind \dt or \d+? psql will tell you, and the SQL it prints is a free lesson in the system catalogs.
Start psql with -E (long form --echo-hidden). It echoes the actual queries generated by \d and other backslash commands, according to the docs, and it is the same as setting the variable ECHO_HIDDEN to on.
psql -E -d mydb
mydb=> \dt
Before the list of tables, you now see the query psql sent to the server. Copy it into your own script or tweak it for a report.
You can also switch it on inside a session:
\set ECHO_HIDDEN on
And there is a third value. When the variable is noexec, the queries are shown but not sent to the server. That is the safe way to study what a command would do. The default value is off.
Caveat: the output of those catalog queries is long and not always pretty, so use it for learning, not for a chat window you want to keep tidy. With noexec you only see the query text and get no result back.
Further reading: psql (PostgreSQL documentation)