сряда, 29 юни 2022 г.

How to diff directories in Linux

Actually, in konsole, it's very easy to do diff, just write:

diff -q directory-1/ directory-2/

or to get a recursive comparison just for new files.

diff --brief --recursive --new-file dir1/ dir2/  # with long options 
or  
diff -qrN dir1/ dir2/   # with short flag aliases

 source

But I found it easier in this case to use gui, so I installed Meld

 sudo pacman -S meld

It can compare both files and directories and from what I see so far, it works very well. If you click on a file from directory diff, it automatically opens a window with file diff with highlights of the differences , which is super cool. Also, you can edit on place, Go to line and Find and Replace. If only it could remember your previous session it would be perfect. But it definitely works great for my current project.