1

I suddenly got a problem with my bash history. When I type history, it only shows:

 1  history

I tried following commands:

set -o | grep history 
echo $HISTFILE
echo $HISTSIZE
echo $HISTFILESIZE

and I got, respectively, the following results:

history         on
/home/mary/.bash_history
1000
2000

I added also to my bashrc, the following lines:

# Avoid duplicates
HISTCONTROL=ignoredups:erasedups
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend

# After each command, append to the history file and reread it
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"

Everything seems OK but I can't scroll back to retrieve commands and the reason seems the fact that nothing has saved in history and that is why the command history does not contain anything.

Could you please help me to solve this issue ?

user790082
  • 69
  • 1
  • 10

1 Answers1

1

The answer resides in the ownership of the bash_history which was root. I did:

sudo chown mary:mary /home/mary/.bash_history

and that solved the problem.

user790082
  • 69
  • 1
  • 10