0

Is there any way to prevent showing duplicated entries in terminal?

Every time I go up, I see lots of repeated command until I find the command I want

In windows 10 version 2004 they fix this issue, although powershell save every command, but it will not show repeated command when you go up.

I wrote a script to remove duplicated entries starting the oldest, but I'd rather find a way to prevent showing duplicated entries

Here is my script if anyone want to remove the duplicated entries in terminal from the oldest.

tac .bash_history > a.txt
awk '!x[$0]++' a.txt > b.txt
tac b.txt > .bash_history
rm a.txt b.txt
Jeny
  • 1
  • You can suppress adjacent duplicates by setting ignoredups as part of the HISTCONTROL paramater - see for example How to avoid duplicate entries in .bash_history – steeldriver Aug 22 '20 at 18:36
  • I did a search for title and nothing similar found so I started a new question, anyhow I tried adding a new line "export HISTCONTROL=ignoreboth:erasedups" after the comment "# don't put duplicate ..." and I tried replace the line "HISTCONTROL=ignoreboth" I even tried to put at the end nothing works for me, I am still using my script, I will do more tries and return – Jeny Sep 18 '20 at 06:53

0 Answers0