Tags

, ,

I recently moved to using zsh instead of bash. (So, you may expect more of my zsh-related posts). Something that bugged me since the beginning is that when I try to see all the commands used previously using history command, zsh does not list all of them! The correct way to get the desired behavior is to use
$ history 1
in the command line, which literally means start listing from the 1st command in the history file.

Since we are at it, I though it would be nice to post a nice history related function:

h() { if [ -z "$*" ]; then history 1; else history 1 | egrep "$@"; fi; }

If you type
$ h ls
it’ll give you all the history related to the command ls. If it does not follow an argument, then the function just shows normal behavior of “history 1” mentioned above.

Advertisements