#+options: toc:nil num:nil #+date: 2022-09-24 * Comparing the content of two files or directories ~diff~ is a command line utility used to compare two files or directories ** Compare files To compare the content of two files use something like #+begin_example bash diff file1.txt file2.txt #+end_example You can redirect the output to a file and make a patch: a file containing the differences between both files #+begin_example bash diff file1.txt file2.txt > patch.txt #+end_example ** Comparing directories Some arguments may be hepful to have an output showing the differences between two directories: * ~--brief~ (show only the differences) and * ~-r~ (compare the directories that are located within the main directory also) #+begin_example bash diff --brief -r directory1 directory2 #+end_example Another approach to compare all the files within each directory is to use: * ~q~ : Shows only differences * ~r~ : Run the command recursively #+begin_example bash diff -qr directory1 directory2 #+end_example