You can use diff –to-file=FILE2 option to compare all operands to FILE2; FILE2 can be a directory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
## compare all operands to FILE2 echo "hello" > myfile1 ## create some files echo "world" > myfile2 echo "cloud" > myfile3 echo "linux" > myfile4 ## rest of the files are compared with myfile1 diff --to-file=myfile1 myfile2 myfile3 myfile4 ## returns ## 1c1 ## < world ## --- ## > hello ## 1c1 ## < cloud ## --- ## > hello ## 1c1 ## < linux ## --- ## > hello ## myfile1 is compared with rest of the files diff --from-file=myfile1 myfile2 myfile3 myfile4 ## returns ## 1c1 ## < hello ## --- ## > world ## 1c1 ## < hello ## --- ## > cloud ## 1c1 ## < hello ## --- ## > linux rm -r my* |