I have my system setup to record a very large amount of history so I can search past commands for later use.

I want to filter the history command to get a range of lines numbers. For example say I want history between lines 500 and 600. What's the best way to go about that?


Sed can be used to filter between lines:

history | sed -n 500,600p

Old Answer:

history | grep [5-6][0-9][0-9]

Down-side is false positives for any other commands which include any number between 500-600.

  • P.S. sorry for answering my own question so quickly. – Philip Kirkbride Apr 21 '17 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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