bash-tutorial/tutorial/diff.org

34 lines
805 B
Org Mode

#+options: toc:nil num:nil
* 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