Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-vEMnMR/bash-4.4.18=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname output: Linux goa 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.4 Patch Level: 19 Release Status: release Description: I set the following environment variable: - export HISTTIMEFORMAT='%Y-%m-%d %T ' to show timestamp in history - export PROMPT_COMMAND='history -a; history -n' to share history between different terminals In this environment sometimes command lines in history are joined by LF. Repeat-By: I've tested the following environments - Ubuntu 18.04 - bash 4.4.18-2ubuntu1 - bash 4.4.12 (built by me) - bash 4.4.18 (built by me) - bash 5.0 (built by me) - CentOS 6.5 - bash 4.4.18 (built by me) - case-1 # invoke plain bash env - bash --noprofile --norc # set environment variables export HISTTIMEFORMAT='%Y-%m-%d %T ' export PROMPT_COMMAND='history -a; history -n' # clear history rm -f ~/.bash_history history -c history -r # execute some commands ls cd df # show history history 1 2019-05-16 19:42:06 history -r 2 2019-05-16 19:42:00 export PROMPT_COMMAND='history -a; history -n' export PROMPT_COMMAND='history -a; history -n' 3 2019-05-16 19:42:02 rm -f ~/.bash_history rm -f ~/.bash_history 4 2019-05-16 19:42:08 ls ls 5 2019-05-16 19:42:09 cd cd 6 2019-05-16 19:42:11 df df 7 2019-05-16 19:42:13 history # type <C-p> bash-4.4$ history ^Jhistory # type <C-p> bash-4.4$ df^Jdf - case-2 Use 2 terminals (T1 and T2) @T1 env - bash --noprofile --norc export HISTTIMEFORMAT='%Y-%m-%d %T ' export PROMPT_COMMAND='history -a; history -n' @T2 env - bash --noprofile --norc export HISTTIMEFORMAT='%Y-%m-%d %T ' export PROMPT_COMMAND='history -a; history -n' @T1 rm -f ~/.bash_history history -c @T2 history -c @T1 ls @T2 pwd # history 1 is joined by LF history 1 2019-05-16 20:26:29 pwd ls 2 2019-05-16 20:26:30 history @T1 df # history 2 is joined by LF history 1 2019-05-16 20:26:28 ls 2 2019-05-16 20:26:57 df ls 3 2019-05-16 20:26:30 history 4 2019-05-16 20:26:57 df 5 2019-05-16 20:26:58 history