I recently switched from bash to zsh. In bash, one way (besides recursive search) that I used to find previously-run commands was history | grep whatever, where whatever is the bit of command I remember.

In zsh, this isn't working. history returns only a few items, even though my .zsh_history file contains many entries, which I have configured it to do.

How can I output my whole history, suitable for searching with grep?

link|improve this question

62% accept rate
feedback

1 Answer

up vote 4 down vote accepted

History accepts a range in zsh entries as [first] [last] arguments, so to get them all run history 0.

To get the zsh help (at least with mind) type Alt-h over the history command and this will bring up the help for built-ins.

link|improve this answer
Great! That's an annoying default for me, though, so I'm adding this to my aliases file: alias history="history 0" – Nathan Long Jan 12 '11 at 22:06
Not that it matters but the history list starts at 1 and not 0. – ggustafsson Dec 2 '11 at 14:40
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.