How Do I Page Through the Output of a Unix Command?

Question:

  • When I use some Unix commands, the output scrolls off of the screen before I can look at it. Is there a way to pause or page through the output?

Answer:

  • To force a Unix command to pause after displaying each page of output, use the “more” command in a pipeline with your command.
More example:

< command > | more

Here < command > is the Unix command that’s producing the output you would like to page through. As an example, suppose you have a directory listing that is too long to fit on one screen. You would enter the following command to pause after each page:

Directory Listing:

ls | more

After one page of output is displayed, the “more” program waits for you to press the spacebar before displaying the next page. If you want to quit out of the paging process, simply press the ‘Q’ key.

Quit:
Press the 'Q' key

Another program that serves the same purpose is “less”. Less has features not included in “more” such as page up and page down.

Less example:

< command > | less

Want more help with your systems?
Make CAS Your Office 365 Provider!


Source: New feed

2009-03-09T11:00:00+00:00Linux|