Linux – “less” (linux) get/go-to X offset in file

lesslinux

I open a big file with this command:
less +G /var/log/blah/file.log

Now when I find the desired info I'd like to know its exact offset in this file, so later I can open that file again and return to that exact place.

So there is the "%X" command which will take me to % inside the file, in offset terms (and not lines!). It's fine, but I'd really love to be able to move to exact, numeric, offset in the file.

What is the command to get the current offset?
And what is the command to move to a specific offset?

And if I'm at that already, how do I get the current offset in percent? (to be used with the "%" command).

Note that I know of marks. They aren't what I'm looking for.

Best Answer

Got part of my question from here:

100g to go to the 100th line
50p to go to 50% into the file
100P to go to the line containing 100th byte

To determine the current line number or byte offset, use Ctrl+g.

Related Question