Someone or something is connecting to your account and executing a bash shell with that command.
Add something like this to you bash profile (after taking a backup of it):
(date; who -a; ps -ef) >> /tmp/bash_logon.txt
Do NOT log out when you've done that, try a new logon first to see if you still can. Remove that line when you've seen enough.
HISTORY_IGNORE is interpreted as a zsh wildcard pattern, so provided you set the extendedglob option, you can define
For zsh not to save entries that don't start with recordthis into $HISTFILE.
^ is the negation glob operator. See also the ~ except (or and-not) operator (also requires extendedglob):
The only option needed to trim all duplicates is histignorealldups, and you have it already set, so yes, duplicates are being removed
but from memory
And you are looking to the history stored in file (cat $HISTFILE).
how to reproduce
Start a new zsh instance, erase all history entries and execute some commands
% zsh -i
% a=( $(setopt) )
% unsetopt $a
The error is raised because xargs cannot find a history command. It is a shell builtin, as you can confirm with type history, thus not visible to xargs. Try
echo 1 | xargs history -d; echo $?
The return value is 127. In man xargs, EXIT STATUS section:
0 if it succeeds
123 if any invocation of the command exited with status 1-125
124 if the command exited ...
Per SteelDriver's comment, I'd misunderstood which shell I was in, as running bash --version had given output, I'd assumed I was within a bash shell. In fact, I'd just called the exe with a command line parameter. I'd been using /bin/sh.
The solution to enabling the expected cursor behavior was to switch to a shell which supported it; i.e. bash. To do ...
Not sure if this is what you are looking for, but before running commands that you would not want in the history you can disable it for the current shell with
$ set +o history
then ctrl-p will show only that and nothing afterwards
I had a similar issue and just figured it out today.
I use oh-my-zsh which sets SAVEHIST=10000. My history was over 10,000 lines, but I think the oldest commands are removed to make room for the new ones that come in, and 10k was working okay. However, I had another issue with oh-my-zsh which I was debugging, and at one point completely removed . $ZSH/oh-my-...