Less ‘+>’ /path/to/file

less

So Gilles mentioned in the chat room that:

less '+>' /path/to/file

can be used with less in order to view a file in reverse. I've never seen it before.

I'm curious – what's going on with the +> operator in the title? Is this less specific syntax? Can it be used otherwise? Are there similar operators I should probably know about?

Best Answer

It's less specific (you can guess this with the quotes around the operator to avoid the shell interpreting it). The + argument tells less to apply this command after opening the file, in this case > which is the keystroke for going to the end of the file. You can try this out by opening some (long) file with less and hitting >. +> is just a shortcut for this. A fairly more common use-case you'll find in the wild is calling less +## /path/to/file where ## is a line number you want to be displayed by less.

At least +## also works for vi and emacs.

Related Question