Sample Header Ad - 728x90

HISTTIMEFORMAT not working as desired in RHEL 8 bash 4.4.20

-2 votes
2 answers
50 views
so trying to capture history with date and readable timestamps AND the command should appear on same line. following is failing: Bash ver is: GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-gnu) OS: RHEL 8.x in .bashrc.... setopt EXTENDED_HISTORY export HISTTIMEFORMAT='%F %I:%M:%S %T' #export HISTTIMEFORMAT="%F %T " export HISTSIZE=1000 export HISTFILE=$HOME/.bash_history-$USER export HISTFILESIZE=1000 export PROMPT_COMMAND='history -a' env variables: $ env|grep HIST HISTCONTROL=ignoredups HISTTIMEFORMAT=%F %I:%M:%S %T HISTFILE=/home/user1/.bash_history-user1 HISTSIZE=1000 HISTFILESIZE=1000 the records appear as: #1753745611 cd #1753745616 ls -ltra|tail #1753745626 cat .profile #1753745633 cat .kshrc **expected:** Mon Jul 28 23:33:31 GMT 2025 cd Mon Jul 28 23:33:36 GMT 2025 ls -ltra|tail Mon Jul 28 23:33:46 GMT 2025 cat .profile Mon Jul 28 23:33:53 GMT 2025 cat .kshrc two problems with this. 1. Timestamp appears in UNIX EPOCH format. 2. Timestamp and command appears on separate lines. They should be together. Also behaves the same way when using KSH. How can this be fixed? preferably using HISTTIMEFORMAT Thank you.
Asked by Rajeev (256 rep)
Jul 29, 2025, 03:33 PM
Last activity: Jul 29, 2025, 10:01 PM