qnd:bash_configuration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
qnd:bash_configuration [2023/01/10 23:39] mguptonqnd:bash_configuration [2023/03/31 11:34] (current) mgupton
Line 8: Line 8:
 # #
 shopt -s histverify shopt -s histverify
-export HISTIGNORE="history*:[ \tbf]g*:hh:jobs:fc:clear"+# Exclude things from being saved in history 
 +export HISTIGNORE="history*:[ \tbf]g*:hh:hs:jobs:fc:clear:man *"
 # Prevent duplicate entries # Prevent duplicate entries
 export HISTCONTROL=ignoreboth:erasedups export HISTCONTROL=ignoreboth:erasedups
Line 15: Line 16:
 # Add date-time stamp for commands in history output # Add date-time stamp for commands in history output
 export HISTTIMEFORMAT="%F %T " export HISTTIMEFORMAT="%F %T "
 +#
 +# Add current line to history without executing it.
 +#
 +bind '"\C-q": "\C-a history -s \C-j"'
  
 # #
Line 28: Line 33:
 stty -ixon stty -ixon
    
-alias ls='ll -haltr --color'+alias ll='ls -haltr --color'
 alias grep='grep -i' alias grep='grep -i'
 alias hh='history | sort -nr | less' alias hh='history | sort -nr | less'
 alias hg='history | grep' alias hg='history | grep'
 alias nn='nano' alias nn='nano'
 +alias ha='history -a'
 +alias hs='history -s'
 </code> </code>
  
Line 39: Line 46:
 # Handle saving history with multiple shells # Handle saving history with multiple shells
 # After each command, append to the history file and reread it # After each command, append to the history file and reread it
 +# Ref: https://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows
 PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r" PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
 </code> </code>
  • qnd/bash_configuration.1673393990.txt.gz
  • Last modified: 2023/01/10 23:39
  • by mgupton