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/']
bash keeps it in working memory, bash can be configured to save it when bash closes or after each command, and to be loaded when bash starts or on request.

If you configure to save after each command, then consider the implications of having multiple bash running at same time. (command lines will be interleaved)
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`.