Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
Do you want just the file list or the actual contents of each file? –  queueoverflow Oct 4 '11 at 17:05
    
I want the file list and if possible the different contents between files with same path. –  isoman Oct 4 '11 at 17:22
1  
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 at 11:21

17 Answers 17

up vote 103 down vote accepted

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)

meld

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

share|improve this answer
    
trying it now, sounds and looks like a good fit. –  DevelopingChris Nov 10 '10 at 19:37
    
Meld is AMAZING. I use it as my source control diff. –  Matt Joiner Nov 11 '10 at 0:30
1  
+1 :) I didn't even realize meld could do directory comparison. –  Evan Plaice Feb 16 '11 at 9:57
4  
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 '13 at 9:33
    
Also works great at comparing text files side by side, or even copy paste stuff. Best interface I've seen! –  clickstefan Aug 23 at 12:30

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.

share|improve this answer
    
Installed colordiff and used colordiff -ur path1 path2 –  warvariuc Nov 6 at 6:44

'Beyond Compare' is available for Linux too.

Check their download url: http://www.scootersoftware.com/download.php

share|improve this answer
    
Beyond compare is most helpful us.. I should prefer it.. –  Ajitha Ms Aug 18 at 7:10

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.

share|improve this answer
    
I've never really tested the file comparison capabilities of GC, but I do love it as a great dual pane file manager. I'll have to dig into it more. –  Dennis Nov 10 '10 at 18:51
    
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 '10 at 19:23

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
share|improve this answer

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.

Krusader

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

share|improve this answer
    
You can also use "Tools -> Synchronise Directories" to get a recursive files changes view of the two directory panels. –  Agelos Pikoulas Feb 20 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 at 9:38

Command line tools

Inspired by this blog entry.

diff

Listing different files:

diff -qr folder1 folder2

Listing also content:

diff -Naur folder1 folder2

rsync

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
share|improve this answer

KDiff3 install kdiff3

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

kdiff3

There is also dirdiff install dirdiff for directories.

dirdiff

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

You can use diffuse:

sudo apt-get install diffuse
diffuse file1 file2
share|improve this answer
    
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 '13 at 1:42

You can try meld.

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

share|improve this answer
1  
Meld is a GUI for diff, btw. –  Marco Ceppi Oct 4 '11 at 17:46

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
share|improve this answer

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.

share|improve this answer

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

share|improve this answer
    
-1 Already mentioned by luri. –  JJD May 11 at 9:05

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.