Skip to content

Instantly share code, notes, and snippets.

@hugooliveirad
Created May 18, 2015 18:30
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugooliveirad/89c739e0f78a3728e5b1 to your computer and use it in GitHub Desktop.
Save hugooliveirad/89c739e0f78a3728e5b1 to your computer and use it in GitHub Desktop.
Diff two command outputs (stdout) without using files

Source: https://crashingdaily.wordpress.com/2008/03/06/diff-two-stdout-streams/

You can diff two commands stdout without creating two files. <( ... ) command creates a temporary file with the stdout of the command inside it.

Example:

diff -B <( ls -1 / ) <( ls -1 ~ )

<( ... ) enables you to use any stdout as a "file" input to commands that need to work on files (like diff does).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment