I read the doc for history and it says:
history [n]
history -c
history -d offset
history -anrw [filename]
history -p arg [arg ...]
history -s arg [arg ...]
With no options, display the command history list with line
numbers. Lines listed with a * have been modified. An
argument of n lists only the last n lines.
But in my zsh, it always displays the first n lines. I need to use history | tail -n to show the last few lines.
The documentation for zsh history, in zshbuiltins(1), is:
history
Same as
fc -l.
where fc -l is:
fc -l [ -LI ] [ -nrdfEiD ] [ -t timefmt ] [ -m match ] [ old=new ... ] [ first [ last ] ]
If
firstis not specified, it will be set to -1 (the most recent event), or to -16 if the-lflag is given. Iflastis not specified, it will be set tofirst, or to -1 if the-lflag is given. However, if the current event has added entries to the history withprint -sorfc -R, then the defaultlastfor-lincludes all new history entries since the current event began.When the
-lflag is given, the resulting events are listed on standard output.
so run:
history -<n>
with a hyphen-minus, as in history -16, to see the last n lines of history in zsh.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With