File and directory comparison tool?

I’m looking for something that will compare directories and files like Beyond Compare does for windows.

Its mainly for use of source control, but I need to use it for deployment as well.

Asked By: DevelopingChris


Maybe Meld is what you are looking for.
Or here are some other alternatives.

Answered By: sagarchalise

‘Beyond Compare’ is available for Linux, too. Check their download URL.
Their german site is at

Answered By: aneeshep

Meldinstall meld

Meld is a tool that can compare and merge files and directories. It is a GUI analog to the standard diff install diffutils and patch install patch command line tools. (See man diff and man patch for more details on those)

enter image description here

Also, lots of source control systems (such as bzr install bzr-gtk or git install git) have the ability to create diffs between versions.

Answered By: dv3500ea

KDiff3 install kdiff3

It is a graphical front-end to diff for KDE users (or if you don’t mind using Qt apps).


There is also dirdiff install dirdiff for directories.

Answered By: tinhed

Gnome Commanderinstall Gnome Commander

The interface might not be real sexy, but it’s extremely powerful!

alt text

And if you were used to other *Commander (like Norton, or the likes), you won’t be lost.

Answered By: Huygens

Krusaderinstall krusader

Krusader is a free tool (available in the Software Centre) that shows folder contents in comparison and you can synchronize with a lot of different options. You can filter while synchronising and comparing.


To compare file contents you simply mark two files select "file" > "compare content" and they are compared on a letter by letter basis. the default comparing tool used by krusader is the default KDE tool "Kompare". You can set krusader to use any other comparison tool – like for example one of the above.

This is the most complete solution I ever found and it’s very convenient.
And it supports all the function keybindungs used by midnight commander (norton commander syntax).

Answered By: piedro

Try also FreeFileSync. It has a decent interface, acceptable comparing speed, good filtering of the comparison result, differents ways of syncrhronization. It comes with a folder monitoring tool (RealTimeSync) that can launch FreeFileSync (actually any command or script) when that specific folder (or folders) or the files within are changed. Really worth a try.

More info about it here or here, where you have a PPA, too

From their page, the key features:

Compare files (bytewise or by date) and synchronize them.

No limitations: An arbitrary number of files can be synchronized.

Unicode support.

Network support.

Built-in support for very long filenames (more than MAX_PATH = 260 characters).

Synchronization database for propagation of deleted files and conflict detection

Support for multiple folder pairs with distinct configuration

Full support for Windows/Linux Symbolic Links and Windows Junction Points.

Lean & easily accessible UI: Highly optimized for speed and huge sets of data.

Algorithms coded in C++ completely.

All progress indicators optimized for maximum performance!

Create Batch Jobs for automated synchronization with or without GUI.

Focus on usability:

Only necessary functionality on UI: no overloaded menus or icon jungle.

Select all folders via drag & drop.

Last used configuration and screen settings are saved automatically.

Maintain and load different configurations by drag & drop, load-button or commandline.

Double-click to start external application (e.g. show file in Windows Explorer)

Copy & paste all grid data as text

Delete superfluous/temporary files directly on main grid.

Right-click context menu.

Comprehensive status information and error reporting

Sort file-lists by name, size or date.

Support for filesizes larger than 4 GB.

Option to move files to Recycle Bin instead of deleting/overwriting them.

Ignore directories “RECYCLER” and “System Volume Information” with default Filter. (Windows only)

Localized versions are available for many languages.

Delete before copy: Avoid disc space shortages for large sync-jobs.

Filter functionality to include/exclude files from synchronization (without requiring a re-compare!).

Include/exclude specific files from synchronization temporarily.

Automatically handle daylight saving time changes on FAT/FAT32 volumes.

Portable version available (selectable via installer).

Native 64-Bit version.

Check for updates from within FreeFileSync automatically.

Copy locked files using Windows Volume Shadow Copy Service. (Windows only)

Create regular backups with macros %time%, %date% within directory names

Copy file and folder create/access/modification times when synchronizing

Advanced locking strategy to allow multiple synchronization processes (e.g. multiple writers, same network share)

I’d add it can manage deleted files, moving them to Trash or a folder specified by user. To point a disadvantage: program documentation focuses quite a bit on Windows, less on Linux. But it does its work nicely.

Answered By: luri

Eclipse IDE is a bit heavyweight if you’re just doing comparisons, but it does do a good job of that, amongst other things. You can select 2 projects, paths or files and compare them with each other, and also synchronize with source control servers.

Answered By: Rog

Unison is a fast file synchronization tool that uses the rsync algorithm and lets you preview differences before updating between 2 locations, be they remote or local.

Answered By: Rog

You can try meld.

It’s the repositories and provides a GUI for file or folder comparison.

Answered By: Pavlos G.

Diff is your friend.

diff -ur path1 path2

This will compare all files that are common between path1 and path2.

If you change -ur to -urN then that will also show the contents of files that are only present in one of the paths.

Answered By: Richm

Command line tools

Inspired by this blog entry.


Listing different files:

diff -qr folder1 folder2

Listing also content:

diff -Naur folder1 folder2


If the two directories are not on the same machine, rsync might be the easiest solution. Usually rsync is used in order to sync directories, but you can run it in verbose and dry mode, so it will only list files it would have to change.

rsync -rvnc --delete folder1 server:/path/to/folder2

You can ommit c if you want to compare files based on timestamps and file sizes to speed up everything:

rsync -rvn --delete folder1 server:/path/to/folder2
Answered By: lumbric

You can use diffuse (for files only, not for directories):

sudo apt-get install diffuse
diffuse file1 file2
Answered By: metdos

I learned about hashdeep two weeks ago. And it has some strong advantages:

  • In contrast to meld, it works well for very large folders. Where meld becomes extremely slow and the UI unresponsive (blocked), hashdeep just works at a constant speed
  • In contrast to rsync, hashdeep detects moved files – files with the same content, just in a different directory.

Verbose output is like:

foo/bar.txt: Known file not used
x/foo/M0824_2L.JPG: Moved from y/P1010998.JPG

hashdeep: Audit failed
   Input files examined: 0
  Known files expecting: 0
          Files matched: 6233
Files partially matched: 0
            Files moved: 3695
        New files found: 19257
  Known files not found: 4713
Answered By: geekQ

Use the diff command:

diff -u file1 file2

diff -u selects a format with a few lines of context. A plain diff file1 file2 only lists the differing lines. There are many more options to control the output format, ignore whitespace-only differences, etc.

If you want to write the output to a file, redirect it:

diff -u file1 file2 >file1-file2.diff

IMHO FreeFileSync is very good and more useful than Meld. It’s fast and stable, can do costomizable synchronizations and can also export the result of the comparison into a csv file.

Lanchpad link

Answered By: Reza

Cross-platform, easy, no fuss & profile saving features make Jfilesync my top choice

Answered By: nightcrawler

To compare files


Line 2

You can use the command cmp:

cmp -b "File_1.txt" "File_2.txt"

output would be

a b differ: byte 11, line 2 is  62 2  40  

To compare dirs (your need):

you can use the diff command:

diff -r --brief dir1 dir2

man diff

  -r, --recursive
              recursively compare any subdirectories found

   -q, --brief
          report only when files differ
Answered By: Maythux

A good way to do this comparison is to use “find” with “md5sum“, then a “diff“.


Use find to list all the files in the directory then calculate the md5 hash for each file and pipe it to a file:

$find /dir1/ -type f -exec md5sum {} ; > dir1.txt

Do the same procedure to the another directory:

$find /dir2/ -type f -exec md5sum {} ; > dir2.txt

Then compare the result two files with “diff”:

$diff dir1.txt dir2.txt

This strategy is very useful when the two directories to be compared are not in the same machine and you need to make sure that the files are equal in both directories.

Another good way to do the job is using git

git diff --no-index dir1/ dir2/

Best regards!

Answered By: Adail Junior