Bash – .bash_history vs history command

bashcommand history

When I open my .bash_history file and view my previous commands via the history command, I see that they are not the same exact commands ?

I feel like the .bash_history commands contains less commands, is it because the .bash_history is updated every 24 hours or so ?

Also I wonder is there a limit for the number of commands to appear in my history or .bash_history file ?

Best Answer

What a particular process keeps in memory for the history will vary with what is in a history file depending on a variety of settings and commands, notably the HISTCONTROL, HISTFILE, HISTFILESIZE, HISTIGNORE, and HISTSIZE environment variables, and the fc and history commands, though the history section of the manual will doubtless make for better reading than this.

Related Question