Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have one file that contains a list of files from a server, and a local folder that I compare to that manifest. Obviously, I do 'ls -1 > listing_local' and then diff that file with listing_server.

But is it possible to diff the manifest and the output of ls immediately to the diff command?

share|improve this question

migrated from Jan 27 '10 at 13:56

This question came from our site for professional and enthusiast programmers.

In bash:

diff listing_server <(ls -1)
share|improve this answer

You can pipe the output of a unix command into the input of another.

ls -1 | diff file_goes_here -
share|improve this answer
this won't work – John T Jan 27 '10 at 15:18
Now it does. That's what I get for not testing it first. – Josh K Jan 27 '10 at 16:01
diff listing <(ls -1)
share|improve this answer
ls -1 | diff listing_server -
share|improve this answer
The -1 is unnecessary if the output is not to a terminal. – Peter Eisentraut Jan 27 '10 at 16:42

Your Answer


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.