Is it possible to search all bash stories

If you have 10 xterms open, let's say is it possible to somehow search through all the bash stories?

I can do

history|grep something

for each separately, but sometimes I would like to avoid this.

+4
source share
2 answers

I am going to assume that these xterm windows are for the same user and all are on the same host. If they are not all the same users, then you must change their folder with the history files in order to use the same history file. If you need to do this, check out this thread: https://superuser.com/questions/760830/how-do-i-change-the-bash-history-file-location

, , , bash .bash_history, . , .bashrc, .bash_history, :

# When the shell exits, append to the history file instead of overwriting i
shopt -s histappend

# After each command, append to the history file and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"

: https://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows

+5

Bash ($HISTFILE, ~/.bash_history ). bash , bash , bash.

:

shopt -s histappend

history -a #-a stands for append

history -a PROMPT_COMMAND, .

, , :

history -r

-r

history help history, man 1 bash.

shopt -s histappend history -a PROMPT_COMMAND, (HISTFILESIZE, HISTSIZE) HISTCONTROL, . "ignoreboth:erasedups" .

, Ctrl-R .

+2

Source: https://habr.com/ru/post/1610481/


All Articles