How to disallow psql command history duplicates?
Is this possible to make psql command history delete all duplicate history commands upon enter of new commands?
psql_history file is in the home directory of the postgres user (e.g. /home/postgres/. psql_history ), not in the home directory of the user you originally logged in with.
Type \q and then press ENTER to quit psql . As of PostgreSQL 11, the keywords " quit " and " exit " in the PostgreSQL command-line interface have been included to help make it easier to leave the command-line tool.
psql is a terminal-based front-end to PostgreSQL. It enables you to type in queries interactively, issue them to PostgreSQL, and see the query results. Alternatively, input can be from a file or from command line arguments.
You can try setting in the psql prompt
\set HISTCONTROL ignoredups
you can also set it in a file called .psqlrc
in the user home directory
example from my .psqlrc
file
\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With