Timeline for How to clear history in zsh
Current License: CC BY-SA 4.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 25, 2020 at 15:40 | comment | added | BANJOSA | well you can do it using the old and simple kill -9 $$. If you terminate you session this way you'll get nothing written to history. | |
| Oct 3, 2019 at 20:32 | comment | added | Kresimir | Yeah, that's it! Forgot to turn on EXTENDED_GLOB... Thanks for your help! I learnt a lot today. | |
| Oct 3, 2019 at 20:27 | comment | added | Gilles 'SO- stop being evil' | @Kresimir Works for me: pastebin.com/Ct4JVjYX with 5.4.2. Maybe you don't have extended_glob turned on? That would cause # not to be a wildcard. I didn't think of it because pretty much everyone has it on. | |
| Oct 3, 2019 at 20:17 | comment | added | Kresimir | However, I thought of a workaround. If I use setopt HIST_IGNORE_SPACE I can call erase_history with a space in front of it and it will not get added to the HISTFILE. | |
| Oct 3, 2019 at 20:11 | comment | added | Kresimir | Hmm... It doesn't work. The hook works (if I add echo TEST to the zshaddhistory_erase_history function it echos it on every prompt), but the erase_history still gets added to the HISTFILE. I'm probably doing something wrong. | |
| Oct 3, 2019 at 19:38 | comment | added | Gilles 'SO- stop being evil' | @Kresimir Since a few versions ago you can filter which commands enter the history with a zshaddhistory hook. See my edit. | |
| Oct 3, 2019 at 19:38 | history | edited | Gilles 'SO- stop being evil' | CC BY-SA 4.0 | added 442 characters in body |
| Oct 3, 2019 at 18:27 | comment | added | Kresimir | Thank you! This is a good enough workaround that gives the result that I wanted. The only issue I have with it that the call to the erase_history function gets appended to the HISTFILE and thus remembered, but that's a minor inconvenience. I can run a script that erases every instance of erase_history from the HISTFILE. | |
| Oct 3, 2019 at 18:12 | vote | accept | Kresimir | ||
| Oct 2, 2019 at 19:57 | history | edited | Gilles 'SO- stop being evil' | CC BY-SA 4.0 | setting HISTSIZE=0 locally is enough (thanks Isaac) |
| Oct 2, 2019 at 18:40 | history | edited | Gilles 'SO- stop being evil' | CC BY-SA 4.0 | added 102 characters in body |
| Oct 2, 2019 at 17:58 | history | answered | Gilles 'SO- stop being evil' | CC BY-SA 4.0 |