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
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
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.Why limit yourself to 16bit?
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.
As you can see, Mr. Anderson, we've been keeping our eye on you for some time now
Checking now it's 104,545 unique commands. It goes back to April 2012.
Note that this is just my laptop; things I've run on my work computer or when ssh'd somewhere else aren't included.
# Undocumented feature which sets the size to "unlimited".
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
and just depend on exiting my shells to store data long term.> "Numeric values less than zero result in every command being saved on the history list (there is no limit)."
export HISTFILESIZE=-1
export HISTSIZE=-1I've been using it for the last couple of years. My history file has around a quarter million entries so far.
export HISTCONTROL=ignoreboth:erasedups
Somewhere in your rc files.
If you do, ehe, that's some serious variety of work on the CLI !
mcfly doesn't remove dups and also stores additional info about the executed commands like pwd, timestamp and return code.
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-...
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.
I agree that the default is unfortunate but the points above seem more important.
And bash has already changed numerous features over the years.
promptFunc() {
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
}