I found the solution in your mailing list after I did a search.

https://lists.debian.org/debian-user/2016/02/msg00960.html

I learned history saves until the user logs out, and if I want to append info 
prematurely, do "history -a"

Thank you

On Friday, July 25th, 2025 at 2:52 PM, Veronica Cisneros 
<spam.veron...@proton.me> wrote:

> Utterly confused by the timestamp of the last item of command history vs. the 
> last modified time of .bash_history
>
> I configured all users with HISTTIMEFORMAT="%Y%m%dT%H%M%S%z "
>
> Below I quote anonymized output from bash to commands date, history 12, and 
> alias lis (i.e., "ls -Zilas")
>
> someUser:~$ date
> Wed Jul 23 07:12:56 PM PDT 2025
> someUser:~$ history 12
> 1262 20250723T184953-0700 journalctl | grep -F "Jul 23" | grep DBus
> 1263 20250723T185529-0700 tail /home/anotherUser/.bash_history
> 1264 20250723T185726-0700 lis /home/anotherUser/.*
> 1265 20250723T190000-0700 vim /etc/bash.bashrc
> 1266 20250723T190115-0700 whereis history
> 1267 20250723T190138-0700 man history
> 1268 20250723T190229-0700 man -K bash
> 1269 20250723T191113-0700 journalctl | grep "Jul 23" | grep "DBus"
> 1270 20250723T191221-0700 history 10
> 1271 20250723T191240-0700 lis .bash*
> 1272 20250723T191256-0700 date
> 1273 20250723T191303-0700 history 12
> someUser:~$ lis .bash*
> 45408 4 -rw-r--r-- 1 root root ? 46 Jul 9 19:21 .bash_aliases
> 45551 44 -rw------- 1 root root ? 43252 Jul 23 19:06 .bash_history
> 1213 4 -rw-r--r-- 1 root root ? 571 Apr 10 2021 .bashrc
>
> NOTICE (time stamp in 24hr format 19:12:56)
> someUser:~$ date
> Wed Jul 23 07:12:56 PM PDT 2025
>
> NOTICE last item of history 12
> 20250723T191303-0700 history 12
>
> NOTICE
> the last modified time .bash_history file is 20250723T1906
>
> I expected .bash_history file to be synced to time of last issued command 
> (i.e. 20250723T191303-0700)
>
> WHAT IS THE RELATIONSHIP BETWEEN THE timestamp of the history command entries 
> and the last modified time of bash_history file for the given user?
>
> Is this working as it should?
> Thanx

Reply via email to