Looking at logs from bottom upwards
I think less +G
is what you're looking for — it'll load up the file at the end, and you can use the up arrow (or k) to scroll back. Within the viewer, g will take you to the top of the file and G will take you back to the end. And F will scroll to the end and try to keep reading, like tail -f
.
Some systems have tac
, which is a whimsically-named backward cat
. Without that, you can still do something like
awk '{print NR ":" $0}' $file | sort -t: -k 1nr,1 | sed 's/^[0-9][0-9]*://'
The tac
command is like a reverse "cat", if that's what you're after.
If you just want to view a file by starting at the bottom, why don't you use an editor or "less"?