How to clear PostgreSQL psql command history

Viewed 3082

When login to the database using psql -u postgres, all the commands entered there can be seen in and recalled from history.

I created a role with a password and I would like to clear that entry.

How can I clear the history?

2 Answers

Please check on the /home/user/.psql_history, then open the file if we want we can clear all the commands or the necessary commands and save the file.

Because you used -u postgres, the file should be in the home of your postgres user. In my case it is /var/lib/postgresql/.psql_history.

Related