Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)

If I want to find the differences between two directory trees, I usually just execute:

diff -r dir1/ dir2/

This output gives the differences are between corresponding files. I am only interested in just getting a list of corresponding files whose content differs. I assumed it would simply be the matter of passing the command line option to diff, but I couldn't find anything on my man page.

Any suggestions?

1 Answer

0 votes
by (36.8k points)

You said Linux, so your luck out:

diff --brief --recursive dir1/ dir2/ # GNU long options

diff -qr dir1/ dir2/ # common short options

Should do what you need.

If you also want to Know the differences for files that may not exist in either directory:

diff --brief --recursive --new-file dir1/ dir2/ # GNU long options

diff -qrN dir1/ dir2/ # common short options

Want to be a Linux expert? Come and join this Linux course

Do check out the video below

 

 

Related questions

0 votes
1 answer
asked Jan 21, 2021 in Linux by blackindya (18.4k points)
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...