bashrc.org.md 712 Bytes
Newer Older
maliky's avatar
maliky committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Add this to your .bashrc file

    # don't put duplicate lines or lines starting with space in the history, and erase duplicates
    HISTCONTROL=ignoreboth:erasedups
    
    HISTSIZE=5000
    HISTFILESIZE=10000
    HISTTIMEFORMAT="%Y-%m-%d %H:%M "  
    
    # append to the history file, don't overwrite it
    shopt -s histappend

With a call to  the script log<sub>persistent</sub><sub>history.sh</sub>
The scripts use a second history file to save your history accross terminals

    ph_file="$HOME/.persistent_history"
    
    if [ -f ~/bin/log_persistent_history.sh ]; then
        . ~/bin/log_persistent_history.sh
        PROMPT_COMMAND="log_persistent_history"
    else
        PROMPT_COMMAND=
    fi