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:
Should I care about unnecessary cats?

Both would be functionally equivalent, but when using cat wouldn't it be slower because you have a process first reading the file and then sending it through a pipe to another process, instead of the process just reading the file? But I've seen this usage 'cat file | program' in a lot of examples. I assume they wouldn't use it that much in examples if it had bad performance.

share|improve this question

marked as duplicate by Caleb, Gilles, Michael Mrozek Jul 17 '11 at 19:54

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 1

up vote 5 down vote accepted

Yes, but the bigger slowdown would be starting up the first process(cat).

However, seeing as how the difference is minimal on any computer made in the last 15 years that isn't loaded down very heavily(load avg < 30), the bigger disadvantage is code readability.

share|improve this answer
    
A big +1 for the practical advice, focusing on readability. –  Jefromi Jul 17 '11 at 7:12

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