5 ms·
If any one has tried this, can you confirm whether it copes with having multiple shells overwriting the history files There is nothing more disappointing than
by helsinkiandrew 3y ago
If any one has tried this, can you confirm whether it copes with having multiple shells overwriting the history files
There is nothing more disappointing than not being able to find the cool command line I used a week ago because the shell I opened briefly and forgot about has overwritten it - maybe that's my poor setup though
- loa_in_ 3y agoThis is my least favourite thing about shell history as well. It fails at being shell history log, because it's dropping more than it retains.
- hnlmorg 3y agoI hate that too but it’s worth noting that this is a bashism. It’s not a problem with some other alternative shells.
- jraph 3y agoYep, zsh, and most likely fish and other shells manage to keep all your commands in the history, no matter how many sessions you open.
- calmoo 3y agoI find this can be a bit messy because VS code runs lots of commands in the background that pollute the history with extremely verbose commands.
- deleted 3y ago[deleted]
- wruza 3y agoWhy does it run them in interactive shells? Not surpising given it’s Microsoft, but still worth reporting an issue.
- hnlmorg 3y agoI can’t speak for VSC specifically (I don’t like their terminal emulator so don’t have enough experience using it) but I do know some other applications “paste” (for want a better word) commands into the script interactive shell because they purpose of the shell being open is to provide a REPL and the GUI application just provides a few useful graphical hooks to it. Regarding the history problem, there’s likely a flag VSC can pass to Zsh to disable writing to history for that session. Edit: looks like there are several ways: https://unix.stackexchange.com/questions/692913/temporarily-disable-history-in-zsh https://unix.stackexchange.com/questions/692913/temporarily-...
- gumby 3y agoBash was written when disks were a few megabytes. It’s trivial to tell it to keep an infinite log, as others have commented.
- hnlmorg 3y agoThe issue isn’t the length of the history. It’s that the history is written to at the end of the bash session. So if you have multiple sessions open then one session with overwrite another session log. Even if your point was right though, I’d argue that because Bash is still being maintained, any defaults originating from the 80s should be updated. Yes, I know there are low footprint environments out there that still have writable storage in the region of a few megabytes (or even less), but we have other shells for those use cases.
- gumby 3y agoChanging defaults can have unexpected consequences, especially ones that have storage implication and especially in programs that are so tied to scripting. I agree that the default is unfortunate but the points above seem more important.
- hnlmorg 3y agoChanging bash history retention wouldn’t affect scripts. Scripts don’t write to the history log. And bash has already changed numerous features over the years.
- dmaa 3y agoshopt -s histappend together with HISTSIZE=99999 and HISTFILESIZE=99999 into your .bashrc should do the trick.
- askl 3y agoYes, mcfly can handle that. I've been using it for the last couple of years. My history file has around a quarter million entries so far.
- NetOpWibby 3y agoJFC
- devnonymous 3y agoIf you use bash I'm assuming you don't have ... export HISTCONTROL=ignoreboth:erasedups Somewhere in your rc files. If you do, ehe, that's some serious variety of work on the CLI !
- askl 3y agoI didn't mean the bash history file but the mcfly internal one. mcfly doesn't remove dups and also stores additional info about the executed commands like pwd, timestamp and return code.
- IggleSniggle 3y agoNow I'm wondering if I overuse / abuse my CLI. I don't find this to be a surprising number of deduped entries in the least.
- hawski 3y agoI use this in my bash profile: export HISTSIZE=65535 shopt -s histappend PROMPT_COMMAND="history -a;$PROMPT_COMMAND" I miss it though on other computers and suffer until I set it up on new ones.
- tambourine_man 3y ago> 65535 Why limit yourself to 16bit?
- hawski 3y agoJust a big enough number and I punish myself as I would like to create my own shell/terminal thing and use that instead.
- tambourine_man 3y agoI hope you get to it eventually, but if you do, consider 32 bits instead. Computers are fast, memory is cheap and 16 bits is not that big. My .bash_history is clocking at 55814 now with dedup on. Granted, it's beeing going for years, but still, no reason to punish yourself.
- samstave 3y ago>>>55814 now with dedup on. Granted, it's beeing going for years As you can see, Mr. Anderson, we've been keeping our eye on you for some time now
- tambourine_man 3y agoI wish
- jefftk 3y agoImportant! My history file on my laptop is up to 200,342.
- jefftk 3y agopromptFunc() { echo "$(date +%Y-%m-%d--%H-%M-%S) $(hostname) $PWD $(history 1)" \ >> ~/.full_history } PROMPT_COMMAND=promptFunc Or, in zsh: precmd() { echo "$(date +%Y-%m-%d--%H-%M-%S) $(hostname) $PWD $(history -1)" \ >> ~/.full_history }