I'm new on Unix&Linux and wanted to comment on an already exhaustive approach to a different question. My rep isn't 50, yet (sad), so it won't let me. I tried this solution to this question: Preserve bash history in multiple terminal windows
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
Unfortunately, this causes the result that while I have a growing (merged) history (desired), in new windows, I can no longer cycle through any of it using the 'up-arrow' (undesired). That is, I can only cycle through commands executed within the new window. Eg, if I open a new terminal and have 500 lines of history incoming, I execute 3 commands, I can only cycle through those 501-503 with the up-arrow...
I open a new terminal and do the following:
$ history #enter
.
.
584 foo
585 bar
.
.
600 baz
$ history #enter
1 history
Could somebody explain why this is so, and if there is a workaround? Thanks.
$HISTFILE
s? – Jeff Schaller Jul 10 '17 at 17:01