Saving output of \ commands to disk When I try to run the following command:

my_db&gt; \copy \dt *. to /home/john/list.txt


I get an error:

\copy: parse error at "*"


Why? How can I save the output to disk?
Use the \o command as documented in the manual:

http://www.postgresql.org/docs/current/static/app-psql.html

specifically:

&gt; \o &lt;path_to_the_file_where_you_want_the_output&gt;
&gt; [your command]
&gt; \o 


the last statement switches the output of psql back to stdout.