Bash – How to reverse the bash history list

bashcommand history

Example history:

$ history
1  whoami
2  pwd
3  ls

To get a reversed history list, I do:

$ history|tac
3  ls
2  pwd
1  whoami

But are there any better ways to do this, perhaps that needn't invoke another program, for those without tac installed, for example?

Best Answer

Since the owner of a separate answer deleted it, I'll suggest:

history | sort -rn
Related Question