[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Timestamp of last entry of command history is different than the last modified time of .bash_history. Is this the proper logic?



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 to: