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.

Just wondering; is it possible to skip the cat in

some_command | ssh remote 'cat > outputfile'

? It feels like a UUOC.

share|improve this question
    
It is a UUOC (useful use of cat). –  Gilles May 21 '13 at 19:29
add comment

1 Answer 1

up vote 2 down vote accepted

No, you need something that reads its stdin and writes it to some file. cat is a good choice for that as it supports binary data and doesn't do anything fancy with its input so is small and efficient.

You could do:

... | ssh remote 'cp /dev/stdin outputfile`

But that would not be more efficient and would only work on systems that have /dev/stdin.

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.