Question #6847   Submitted by Answiki on 10/10/2022 at 06:24:31 PM UTC

How to compare two directories with the diff command under Linux?

Answer   Submitted by Answiki on 10/10/2022 at 06:27:25 PM UTC

Under Linux, one can compare the content of two folder with the diff command:

diff -qr folder_1/ folder_2/

The -q (brief) option displays only differences (prevent similar files to be displayed).

The -r (recursive) option also compare sub-folders.


By removing the q option, you can have a file-by-file breakdown of the difference between the two files:

diff -r dossier1 dossier2 | sort




4 events in history
Answer by Answiki on 10/10/2022 at 06:27:25 PM

Under Linux, one can compare the content of two folder with the diff command:

diff -qr folder_1/ folder_2/

The -q (brief) option displays only differences (prevent similar files to be displayed).

The -r (recursive) option also compare sub-folders.


By removing the q option, you can have a file-by-file breakdown of the difference between the two files:

diff -r dossier1 dossier2 | sort




Question by Answiki 10/10/2022 at 06:24:31 PM
How to compare two directories with the diff command under Linux?
Answer by Answiki on 07/31/2022 at 07:19:53 PM

Under Linux, one can compare the content of two folder with the diff command:

diff -qr folder_1/ folder_2/

The -q (brief) option displays only differences (prevent similar files to be displayed).

The -r (recursive) option also compare sub-folders.

Question by Answiki 07/31/2022 at 07:17:44 PM
Under Linux, how to compare the contents of two folders?
# ID Query URL Count

Icons proudly provided by Friconix.