Linux Shell Scripting Cookbook(Third Edition)
上QQ阅读APP看书,第一时间看更新

Generating difference against directories

The diff command can act recursively against directories. It will generate a difference output for all the descendant files in the directories. Use the following command:

    $ diff -Naur directory1 directory2

The interpretation of each of the options in this command is as follows:

  • -N: This is used for treating missing files as empty
  • -a: This is used to consider all files as text files
  • -u: This is used to produce unified output
  • -r: This is used to recursively traverse through the files in the directories