Timeline for Preserve bash history in multiple terminal windows
Current License: CC BY-SA 4.0
16 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 4, 2022 at 1:09 | comment | added | Dan Dascalescu | @JoLiss: agree with Arrow-Up not turning up random commands from other sessions in the current one, but I do want Ctrl+r to search among all commands. Any way to do both? | |
| S Aug 28, 2019 at 7:07 | history | suggested | Noam M | CC BY-SA 4.0 | fix bash code indentation |
| Aug 28, 2019 at 3:37 | review | Suggested edits | |||
| S Aug 28, 2019 at 7:07 | |||||
| Jan 11, 2019 at 22:49 | comment | added | Wowfunhappy | This solution causes running a standard history -c to not work. | |
| Aug 5, 2015 at 20:52 | history | edited | Lesmana | CC BY-SA 3.0 | added 160 characters in body |
| Feb 27, 2013 at 8:01 | comment | added | RichVel | @BrianGordon - there's no secure way to do this really, but you could try pointing HISTFILE to ~youruser/.bashhistory_shared, for both youruser and root. You might as well share the .bashrc as well, which can be done by doing a simple '. ~youruser/.bashrc' in root's .bashrc. | |
| Feb 24, 2013 at 2:34 | comment | added | Rag | Do you know of any way to share history between my user and root? I don't have any security concerns and it would be a time saver for me. | |
| Feb 17, 2013 at 17:56 | comment | added | RichVel | for some working bash code that includes this and other features, see github.com/RichVel/nicer-bash-prompt | |
| Jan 12, 2013 at 22:07 | comment | added | RichVel | outstandingly good answer, this works reliably unlike the more common "history -a; history -n" | |
| Nov 8, 2012 at 17:58 | history | post merged (destination) | |||
| Sep 13, 2012 at 22:14 | history | migrated | from stackoverflow.com (revisions) | ||
| Feb 4, 2012 at 15:15 | comment | added | Jo Liss | After trying this for a bit, I've actually found that running only history -a, without -c and -r, is better usability-wise (though it's not what the question asked). It means commands you run are available instantly in new shells even before exiting the current shell, but not in concurrently running shells. This way Arrow-Up still always selects the last-run commands of the current session, which I find much less confusing. | |
| Feb 1, 2012 at 12:30 | comment | added | Jo Liss | One disadvantage: Commands with multi-line strings are normally still preserved in the current session. With this trick, they are split into individual lines instantly. Using -n for -c -r does not help, neither does cmdhist or lithist. I don't think there is a workaround at this point. | |
| Sep 16, 2011 at 12:02 | comment | added | Lesmana | @Graham: I did not want to use history -n because it messes up the history counter. Also, I found history -n to be too unreliable. | |
| Sep 14, 2011 at 20:40 | comment | added | Grunix | Why not "history -n" (reload lines not already loaded) instead of "history -c; history -r" ? | |
| Jun 16, 2010 at 16:11 | history | answered | Lesmana | CC BY-SA 2.5 |