Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How to pause listing long text file with cat in command prompt after 10lines then press any key. for example:

cat myfiles.txt

bla
bla
bla
bla
bla
bla
.
.
.
bla
press enter to continue
share|improve this question

migrated from serverfault.com Jul 31 '12 at 4:01

This question came from our site for professional system and network administrators.

add comment

4 Answers 4

more and less are pagers which deal with paging through text on the console. less is more functional, but more is closer to what you want. If you specify the -d option more will show how to move to the next page, and you can use -num to specify the number of lines to show at a time (instead of auto detecting the screen size).

% more -d -5 myfiles.txt
bla
bla
bla
bla
bla
--More--(4%)[Press space to continue, 'q' to quit.]
share|improve this answer
add comment

You can use less or more. Both will work.

The less command is more commonly used and provides more functionality than more.

Using both less or more, you can traverse a file page by page using the space bar, and line by line using the enter key.

There's no need to cat and pipe the file, either. You can just run the command on the file.

E.g. less myfile.txt

share|improve this answer
add comment

You should try cat myfiles.txt | more

share|improve this answer
    
less is more common these days –  jeremiahd Jul 31 '12 at 4:52
    
You could also try most instead. –  scai Jul 31 '12 at 5:38
2  
or just more myfiles.txt without the UUOC. –  cas Jul 31 '12 at 7:51
add comment

You can use scroll-lock, although it might not be very useful if data rate is high. Ctrl-s to block and Ctrl-q to unblock.

share|improve this answer
add comment

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.