Diff Two Command Outputs

From Leo's Notes
Revision as of 06:20, 1 September 2019 by Leo (talk | contribs) (Text replacement - "Category:Linux{{Navbox Linux}}" to "{{Navbox Linux}}Category:Linux")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page was last edited on 1 September 2019, at 06:20.

To diff the outputs of two command outputs, such as two ls's, run:

 diff <(cd directory1; ls) <(cd directory2; ls)

This is assuming you are using bash, or a shell that can handle sub shells and pipes similar to bash such as zsh.