Eternal History File

Eternal History File

unified history

cat << EOF | sudo tee /etc/profile.d/ZZ20-eternal-history.sh
# set unlimited history
export HISTFILESIZE=
export HISTSIZE=

# add timestamp to history
export HISTTIMEFORMAT="%F %T | "

# use different file as .bash_history gets truncated sometimes
export HISTFILE=~/.eternal_history

# ignoredups: No consecutive duplicates
# ignorespace: Don't write commands that are beginning with space.
# erasedups: Remove all duplicates from past
export HISTCONTROL=ignorespace:ignoredups:erasedups

# each time a new session is started, history is continued and not overwritten
# enabled by default
# shopt -s histappend

# multi-line commands saved as a single entry, instead of breaking them into separate lines
# enabled by default
# shopt -s cmdhist

# Preserve bash history in multiple bash shells?
# I actually don't want that anymore and there are some strane effects of this
#
# force prompt to write history after every command.
# simplest version: after each command, append to the history file and reread it
# "-a" history to file, "-c" clears history, "-r" reads history from file
#
# PROMPT_COMMAND="history -a; history -c; history -r"
#

# convinient alias
alias h="history"

EOF

Shared history bash - Is it possible to make writing to .bash_history immediate? - Ask Ubuntu

This should be the best way: antofthy.gitlab.io/software/history_merge.bash.txt


Merging multiple history files - to je lako, samo ih appenduješ sa cat npr cat ~/.bash_history_1 ~/.bash_history_2 > ~/.eternal_history i ne moraš da brineš oko stavki koje nemaju tmiestamp jer će automatski svima dodati da su upravo ukucani.


Realtime history? Shared history Preserve bash history in multiple terminal windows - Unix & Linux Stack Exchange

date 14. Mar 2021 | modified 04. Sep 2024
filename: Command Line » Eternal History
Article Content