Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm struggling to figure out a way to do this...I'm using less to view a large (~1GB) file. I want to jump to line "$n" in the file - preferably without having to wait for lines 1-($n-1) to scroll by in my terminal.

I would do this in vim using something like this:

localhost:~# vim myfile +$n

Is there an equivalent command line option? If not, is there a way to do this once the file is open in less?

share|improve this question
1  
A question that bothered me again and again, when i didn't have the time to search for an answer. Typing 'h' might have helped, for it displays the "SUMMARY OF LESS COMMANDS"... –  lajuette Mar 14 '11 at 16:29

1 Answer 1

up vote 49 down vote accepted

If the file is open you can type:

  • 100g to go to the 100th line.

  • 50p to go to 50% into the file.

  • 100P to go to the line containing 100th byte.

You can use these from terminal by adding + in front of them:

less +100g bigfile.txt
share|improve this answer
1  
And don't forget, you can type $ to go to the last line. –  rob Feb 24 '10 at 20:21
    
Hey - THANK you for the examples!! Helped me a lot!! –  Poni Dec 29 '11 at 13:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.