3 ms·
I am unsure how shell history works when there are many terminals open at once. The history within a single shell is not mixed up by this, but I have never lear
by mongol 5y ago
I am unsure how shell history works when there are many terminals open at once. The history within a single shell is not mixed up by this, but I have never learned what happens when the terminals closes. I often wondered what would be the ideal way for history to work with many shells.
- csdvrx 5y agoThe ideal way is an immediate commit to a globally shared database, otherwise each shell in each terminal will only able to access its own history.
- ansible 5y agoI use GNU screen. I use a script to name each GNU screen session "projectA", "sysadmin", etc. Then in my .bash_profile, I set the Bash history to be a separate file in my ~/.bash_hist_dir subdirectory. if [ "x$SCREEN_SESSION_NAME" != "x" -a "x$WINDOW" != "x" ]; then if [ ! -d ~/.bash_hist_dir ]; then mkdir ~/.bash_hist_dir fi export HISTFILE=~/.bash_hist_dir/${SCREEN_SESSION_NAME}.${WINDOW} fi So each separate window in each session gets a unique history file. I have up to 10 windows per GNU screen session, and sometimes 6 to 8 terminal tabs. Each separate GNU screen window is used for specific things: "edit", "build", "debug", etc. This all makes it easy to maintain the context of all the things I work on.