Seems like history [number]
is backward in zshell because it's using fc
. How do I get history [number]
to behave like it does in bash?
➜ exec bash
bash-3.2$ history 3
35 history 5
36 exit
37 history 3
bash-3.2$
➜ history 3
1 pwd
2 ..
3 mv work Documents
➜ history
3133 history 5
3134 exec bash
3135 history
3136 history 3
3137 history -3
3138 history 20
So in bash it behaves like I'd expect: last 3 commands. But in zshell it's backwards: the first 3 history commands. This is annoying and I'd like to fix it.
Closest I've got so far:
function history {
fc -l -$1
}
But that still produces history starting at 1 instead of the last entry.
Related: Show older or newer history items with the history command in zsh
zsh
, but..alias history='history | tail -n${1-10}'
?