For finding difference between two versions of a file on Linux, you can use any one of the 4 tools explained in this article — diff, colordiff, wdiff, and vimdiff.
The screenshots provided for these tools shows the difference between the following two empfile1.txt and empfile2.txt.
$ cat empfile1.txt John Smith 1001 Sr. Engineer Peter 1002 Engineer Fernandous 1003 Sr. Engineer Kraml 1004 Jr. Engineer $ cat empfile2.txt John Smith 1001 Sr. Engineer Peter 1002 Engineer Fernandous 1003 Resigned Kraml 1004 Jr. Engineer Raj 1005 Engineer
1. Diff Command
This is the traditional way to find out the difference two files is using diff command.
$ diff empfile1.txt empfile2.txt 3c3 < Fernandous 1003 Sr. Engineer --- > Fernandous 1003 Resigned 5c5 < --- > Raj 1005 Engineer
Fig: Diff command output
2. Colordiff Command
Colordiff shows the diff in color as shown below.
Fig: Colordiff Command output
3. Wdiff Command
Wdiff command output:
John Smith 1001 Sr. Engineer Peter 1002 Engineer Fernandous 1003 [-Sr. Engineer-] {+Resigned+} Kraml 1004 Jr. Engineer {+Raj 1005 Engineer+}
- It covers the removed word / line with [- -]
- It covers the added word / line with {+ +}
Fig: Wdiff Command output
4. Vimdiff Command
We discussed earlier about Vimdiff in detail.
Fig: Vimdiff Screenshot
Comments on this entry are closed.
Colordiff , Wdiff is not available in RHEL .
meld is the way to go!
How about tkdiff…
I like it!!!
You forgot two of the standard utilities: comm and cmp.
meld is much better. But, still it requires the files to be in the same folder structure.
There is another tool, diffuse, available from the deb repositories. (I don’t know about
rpm or other packages.) It presents the differences in parallel columns as a GUI.
Scrolling is in sync for each comparison.
~~~ 0;-Dan
Another great diff tool written in python
thanks,
you can download wdiff for rhel from
http://www.gnu.org/software/wdiff/wdiff.html
another great tool, kompare in kde