Create a backslash command alias

psql's backslash commands such as \dt (list tables) are compact and quick to type, however they are sometimes not always easy to remember. \dn comes to mind - it lists schemas (the more intuitive \ds lists sequences) - for a mnemonic, think of 'n' as standing for namespace.

Though it isn't possible to directly define your own more memorable aliases for backslash commands, psql's variable interpolation provides a handy workaround:

testdb=# \set list_schemas '\\dn'
testdb=# :list_schemas
  List of schemas
  Name  |  Owner   
--------+----------
 public | postgres
(1 row)