Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I compare two source trees in Linux? [closed]

Tags:

diff

I have two directories containing source files to a project I've inherited with little by way of documentation. How do I compare both directories to make see what the differences are?

like image 654
freakwincy Avatar asked Apr 22 '09 11:04

freakwincy


People also ask

Which command is used to compare two files Linux?

Use the diff command to compare text files. It can compare single files or the contents of directories. When the diff command is run on regular files, and when it compares text files in different directories, the diff command tells which lines must be changed in the files so that they match.

How do I compare two files in a folder in Linux?

Normally, to compare two files in Linux, we use the diff – a simple and original Unix command-line tool that shows you the difference between two computer files; compares files line by line and it is easy to use, comes with pre-installed on most if not all Linux distributions.


1 Answers

Try this:

diff -Naur dir1/ dir2/ 
  • The -u option makes the output a little easier to read.
  • The -r option recurses through all subdirectories
  • The -N and -a options are really only necessary if you wanted to create a patch file.
like image 152
jcrossley3 Avatar answered Sep 28 '22 03:09

jcrossley3