1. To download the output as csv file, type the following command on Postgres terminal...
myproject=# copy (select place_id,place_name from places where place_type ='county court') to '/home/praveen/Downloads/test.csv';
2. To download the output as txt file, type the following command on Postgres terminal...
myproject=# copy (select place_id,place_name from places where place_type ='county court') to '/home/praveen/Downloads/test.txt';
If you are getting permission error, create a file test.csv/test.txt in the desired folder and provide read-write access to all. Also, you need to write your own select query. The query I have mentioned is just an example. :)