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.

Possible Duplicate:
Run a command for a specified time and then abort if time exceeds

Looked all over and I can't find the answer...

Simple question: How can I cat a large file for, lets say, 45 seconds and output it to the screen or redirect to another file.

Thanks!

share|improve this question
add comment

marked as duplicate by Michael Mrozek Feb 8 '12 at 20:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 2 down vote accepted

You could try:

timeout 45 cat yourfile

See also http://stackoverflow.com/questions/5161193/bash-script-that-kills-a-child-process-after-a-given-timeout

share|improve this answer
    
timeout is cleaner and allows the duration option to be specified in seconds, minutes, hours, as well as the option to specify which signal to send. cleaner and more readable –  bdowning Feb 8 '12 at 20:14
add comment

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