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 [2021/12/08 19:55] 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"+# Exclude things from being saved in history 
 +export HISTIGNORE="history*:[ \tbf]g*:hh:hs:jobs:fc:clear:man *" 
 +# Prevent duplicate entries 
 +export HISTCONTROL=ignoreboth:erasedups 
 +# When the shell exits, append to the history file instead of overwriting it 
 +shopt -s histappend 
 +# Add date-time stamp for commands in history output 
 +export HISTTIMEFORMAT="%F %T " 
 +
 +# Add current line to history without executing it. 
 +
 +bind '"\C-q": "\C-a history -s \C-j"'
  
 # #
 # Bind the keyboard combination Alt + h to displaying the command history. # Bind the keyboard combination Alt + h to displaying the command history.
 # #
-bind '"\eh":" history | sort -nr | less\n"' +bind '"\eh":" history | sort -nr | less\n"' 
-bind '"\ew":" jobs\n"'+bind -x '"\eh":" history | sort -nr | less"' 
 +bind '"\ew":" jobs\n"' 
 +bind -x '"\ew":" jobs"'
 # #
 # Disable flow control, so Ctrl + s can be used for forward searches in history to go with reverse searches (Ctrl + r) # Disable flow control, so Ctrl + s can be used for forward searches in history to go with reverse searches (Ctrl + r)
Line 20: Line 33:
 stty -ixon stty -ixon
    
-alias ls='ls -haltr --color | less -R'+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>
  
 +
 +<code bash>
 +# Handle saving history with multiple shells
 +# 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"
 +</code>
  • qnd/bash_configuration.1638993352.txt.gz
  • Last modified: 2021/12/08 19:55
  • by mgupton