So I'm trying to teach myself Unix and I changed my MacOS terminal shell from the default zsh to bash, because the Coursera courses that I studied use Bash scripting and so does the First Semester in you CS Education that I intend to follow along.
I downloaded the latest bash using brew install and change the default to bash using chsh -s command.
I noticed, when I'm trying to learn bash history today, that my bash doesn't seem to store history command to the .bashhistory file.
For one thing, I'm unable to open the bashhistory file, supposedly because of the security setup of MacOS, but I just noticed that I lost all the history once I closed my terminal.
This is the code I run
apples-MacBook-Pro:~ apple$ sudo cat ~/.bash_history
sudo zsh
apples-MacBook-Pro:~ apple$
It goes without saying that I have more history command than just that. Also, I can't use up arrow to retreive historical command, at least not the ones that I typed in before closing off the old terminal and opened a new one, even though I distinctly remember being able to do that for the zsh shell.
BTW, I believe the history size is set to 500, rather than 1, which was my original suspision.
apples-MacBook-Pro:~ apple$ echo $HISTSIZE
500
Thanks in advance for your time.
sudo
here is a bit suspicious. Can you as a normal user read this file? (If not, why not?) What owner and what permissions does the file have according tols -l
?