Amit Agarwal

Linux and Photography Blog
marketing

In Linux you can use diff command to find the differences in file.

What is interesting is that you can use “diff -u” to list the differences with ‘+’ and ‘-’ rather than sometimes confusing ‘>’ and ‘<’.

An interesting article on finding the difference in files can be read here.

For reference:

Visual Diff Tools in Linux

****This is a not a post about how to use diff and patch commands.****
Running the regular diff between two text files to see the differences is not so elegant for the human eye to decode. Luckily there are plenty of tools out there to make this easy.

Command Line:

sdiff file-1 file-2


This is a much more elegant tool compared to diff, if you are looking for a quick command-line utility that shows the difference between two text files. While using it on big files, its better to pipe the output to less command.

sdiff file1 file2 | less

Disadvantage – this is a read-only output. No editing or merging is possible. But its a great tool for a quick visual inspection.


Update: Use sdiff -o out_file file1 file2 to interactively merge file1 and file2 and write the output into out_file. (Thanks to anonymous commenter)

vimdiff file-1 file-2


This can open “n” number of files in a vertically split vim environment. This has color highlighting to specify the areas that differ in the file. Editing is possible. This is a complete vim-environment, so all the vim keys are usable.

Emacs:

M-x ediff-buffers
This is an emacs equivalent of vimdiff with copy to left, copy to right, merge changes and much more. This is a special ediff mode which has its own key bindings. Hit ? to get help on the keyboard shortcuts.

Colored highlighting for distinguishing differences. Easy navigation to diff regions.

A maximum of 3 files can be compared and merged. Both comand-line and gui mode are available.

Visual Tools:

Meld:

Image borrowed from Meld website

Can compare two or three files and allows editing. The differences are dynamically updated. This can work with version control systems like CVS, SVN etc. Folder comparison is possible.

Guiffy:

Screenshot borrowed from Guiffy website.

Multi-platform visual diff and merge tool. Has a three-pane view for comparing two-files and the third pane to view the merged output file. Works in Window, Linux and Mac OS X. Folder comparison is possible.

I am sure there are more tools out there (such as xxdiff) but I don’t feel like reviewing them (too ugly). :)

**Update:

kdiff3:

Taken from the kdiff3′s website.

Thanks to the anonymous commenter. An excellent tool from the kde bunch. I loved it. Has the option to compare 2 or 3 files. Has an extra window pane to look at the out of the merged file. Directory differences and merging are possible.

Technorati Tags: , , , ,

Enter Your Mail Address

Diff Linux command — Find the difference in files the easier way.
Hot:sun Diff Linux command    Find the difference in files the easier way.sun Diff Linux command    Find the difference in files the easier way.sun Diff Linux command    Find the difference in files the easier way.sun dark Diff Linux command    Find the difference in files the easier way.sun dark Diff Linux command    Find the difference in files the easier way.

You are welcome to my blog. Please feel free to share your Good or Bad experiences with me through comment or through email.

Originally posted 2008-10-07 10:42:27.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • blogmarks
  • Blogosphere News
  • co.mments
  • HelloTxt
  • Ping.fm
  • Reddit
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Add to favorites
  • BlinkList
  • Diigo
  • email
  • Identi.ca
  • LinkedIn
  • Live
  • MyShare
  • MySpace
  • PDF
  • SheToldMe
  • Slashdot
  • Socialogs
  • Tumblr

related post

Technorati Tags: ,

Diff Linux command — Find the difference in files the easier way.

Facebook comments:

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment



IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

What is 13 + 11 ?
Please leave these two fields as-is:
information
podcast

© 2010 Amit Agarwal | Entries (RSS) and Comments (RSS) | Valid CSS 2.1 Valid XHTML 1.0 Transitional

Powered by Wordpress 3.0, design by Abel, handcrafted by Abel County Laboratories, based on Wsg Standards Wsg Standards

jobs

Switch to our mobile site

Page optimized by WP Minify WordPress Plugin