<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1046278168754291&amp;ev=PageView&amp;noscript=1">
Blog

Monday, 09 March 2009 07:00

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

Written by Louise Fahys
Be the first to comment!

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!

Tagged under Linux

Louise Fahys

Louise Fahys

"My passion is to take ideas and build them into software solutions that help people." Louise has over 20 years of business and technical experience including project management, website design, architecture and implementation. Louise has helped start and run several interactive sites for sports organizations and businesses.

Subscribe to Email Updates