If I run `history`, I can see my latest executed commands.

But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed.

Does the file get locked, is there a temporary location or something similar?
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
Commands are saved in memory (RAM) while your session is active. As soon as you close the shell, the commands list gets written to `.bash_history` before shutdown.

Thus, you won't see history of current session in `.bash_history`.
The easiest way to find where your bash history is stored is with this:

`echo $HISTFILE`