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.

  • Do you want just the file list or the actual contents of each file? Oct 4, 2011 at 17:05
  • I want the file list and if possible the different contents between files with same path.
    – isoman
    Oct 4, 2011 at 17:22
  • 2
    It would be handy if the GUI tool allows hiding folders & files which are identical. This would it make much easier to concentrate on the odd folders & files. Does anyone know a tool which supports this feature?
    – JJD
    May 11, 2014 at 11:21
  • Have a look at unison. Beyond compare does the "one-stop shop does it all" approach, while unison focuses on handling tree traversal, keeping state and propagating changes, covering Beyond Compare features by delegating things like diff, 3-way merge, etc. to whatever is your favorite program working at file level. Unison is free, very robust and mature software, can quickly detect and synchronize huge trees, through network between different OSes, etc. Read doc first, especially on Windows. Feb 7, 2016 at 20:25
  • emacs has a directory compare tool. Like everything emacs, the eye candy is, well, "what does eye candy even means?", yet it shows contextual help with keys, allows with a few keystrokes recursive analysis, hide identical files or even subdirs, interactively choose files to show color-coded differences with various options, interactively merge, propagate or perform arbitrary edits on files, easily go to next file or dir, keeping track of state, with all usual editing facilities. Feb 7, 2016 at 21:35

20 Answers 20


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.

  • 2
    Meld is AMAZING. I use it as my source control diff. Nov 11, 2010 at 0:30
  • 12
    Just tried out on a bigger folder - 4 GB, 2000 files. Functionality of meld is as desired. But for this folder meld is extremely slow and the UI is unresponsive (blocks). Using rsync now.
    – geekQ
    May 7, 2013 at 9:33
  • 1
    Also works great at comparing text files side by side, or even copy paste stuff. Best interface I've seen! Aug 23, 2014 at 12:30
  • 1
    @geekQ as a fast alternative, able to handle as big of a folder as you want instantaneously, see beyond compare below. superior to meld imho
    – phil294
    Nov 27, 2016 at 18:24
  • 1
    Meld crashes everytime i want to select a folder :/ I have the newest version availabe on my distribution repository (Ubuntu 14.04)
    – Youda008
    Apr 13, 2017 at 14:49

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.

  • 2
    Installed colordiff and used colordiff -ur path1 path2
    – warvariuc
    Nov 6, 2014 at 6:44
  • Does not work in cygwin. Oct 16, 2016 at 18:47

'Beyond Compare' is available for Linux, too. Check their download URL.
Their german site is at http://www.beyondcompare.de/.

  • Beyond Compare is particularly useful when doing an ssh (with key or password) to a remote host and comparing that to a local copy. Oct 5, 2016 at 10:43

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

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.

  • 1
    I haven't use it to compare 2 files, but I've used it to tell me which files were different while comparing to directories. This is especially useful when sorting out photographs ;-)
    – Huygens
    Nov 10, 2010 at 19:23

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

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).

  • You can also use "Tools -> Synchronise Directories" to get a recursive files changes view of the two directory panels. Feb 20, 2014 at 10:56
  • unfortuately the synchronizer in krusader is unmaintained: bugs.kde.org/show_bug.cgi?id=270150#c7. Is there an alternative that is actively maintained?
    – rubo77
    Feb 24, 2014 at 9:38
  • 1
    @rubo77 : this bug has been fixed in the meantime.
    – mivk
    Aug 28, 2018 at 17:07

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.


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


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

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!


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.


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.


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

sudo apt-get install diffuse
diffuse file1 file2
  • 2
    I often use Diffuse for one killer feature - the ability to manually set merge anchors. It doesn't do directories (yet), but for individual and messy diffs, the anchors feature is awesome.
    – Sk606
    Dec 10, 2013 at 1:42

You can try meld.

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

  • 1
    Meld is a GUI for diff, btw. Oct 4, 2011 at 17:46

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.


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


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


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

Best readable console-based "directory with content diff" that I've found so far:

diff -N dir1 dir2 | colordiff

diff -uN dir1 dir2 | colordiff (adding some line context)

Or if you want to go recursive:

diff -rN dir1 dir2 | colordiff

diff -urN dir1 dir2 | colordiff (adding some line context)

colordiff can be installed by sudo apt install colordiff.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .