\g
Execute last query again
\p
Show current query buffer
\r
Reset/clear query buffer
\e
Edit query buffer in external editor
\i filename
Execute SQL commands from file
\o filename
Send query results to file
\o
Stop sending output to file
\timing
Toggle timing of queries
\watch [seconds]
Repeat query every N seconds
\copy table FROM 'file.csv' CSV HEADER;
Import CSV data to table
\copy table TO 'file.csv' CSV HEADER;
Export table data to CSV
\COPY (SELECT...) TO 'file.csv' CSV;
Export query results to CSV
\w filename
Write query buffer to file
\ir filename
Execute file relative to current script
\gx
Execute query with expanded output
\gset
Execute query and store results in variables