EDIT: Partial solution for now is to call exec zsh in my bashrc and call it a day. I don’t like it but history behaves normally at least.
I have been trying to fix this for ages.
Adding HISTCONTROL=ignoredups or HISTCONTROL=erasedups does not work as pressing the Up arrow key goes to last environment variable in my bashrc. My bash_history duplicates bashrc for every shell I open. It has been a few months since I actually used my history.
The first few lines of my bashrc are as follows:
set -o history
export HISTFILE=~/.bash_history
export HISTCONTROL=ignoredups
export HISTSIZE=100000
export SAVEHIST=100000
I had copied over the .histfile when I was using zsh. Zsh broke for me a while back, wouldn’t let me log in or use anythin in /bin so I reverted to Bash but the history is still messed up. I can still ctrl-R and find commands, but it’s suboptimal, I heavily rely on History to get any work done. Any help would be awessome! Thanks!
I tried both suggestions. But with every second new terminal I open, the bashrc duplicates again into bash_history.
Before your sort suggestions, I manually removed duplicates (luckily I didn’t have much history to go through). But this too did not work. Overwriting is fine but with a new terminal bashrc duplicates take over the latest commands
The whole problem began when I backed up my home and root from another drive to new one using timeshift… There may have been some error, but after I successfully managed to make Arch work on the new drive I realised my zsh was breaking. That was when I moved back to bash. Maybe the timeshift issue is independent but I can’t think of any other reason.
I am seriously considering to either reinstall Arch, but all the programs from Spack installs are going to take ages to compile T_T. My other option is to learn to use the history command and sort and grep through that to find what I want
No. You misunderstand. The next terminal I open writes the contents of bashrc into bash_history so copying or overwriting or editing contents of bash_history is pointless. Thanks for your reply anyway