Linux Online Advertisement
[ Register ]

[ Applications ]
[ Documentation ]
[ Distributions ]
[ Download Info ]
[ General Info ]
[ Book Store ]

Advertisement

[ Courses ]
[ News ]
[ People ]
[ Hardware ]
[ Vendors ]
[ Projects ]
[ Events ]
[ User Groups ]
[ User Area ]

Moving to Linux: Kiss the Blue Screen of Death Goodbye!

[ About Us ]
[ Home Page ]
[ Advertise ]

Tips: Development

showing the differences between two files

One of the most common tools used by developers is 'diff'. This utility, found on most Linux systems, can be used to see the differences between two versions of a file. Let's say you've created a file called joe_file and your friend Jack has taken that file and changed it somewhat or made some improvements. To see the differences between the two files, you could run a command like this:

diff -u joe_file jack_file


create and apply a patch

If you're developing applications and somebody has made some improvements, you can patch the original source code to the application by creating a diff between the two files and then using the 'diff' file to patch the original one.

diff -ruN old_file new_file > my_patch.diff

The following command will patch the file 'old_file' with the new lines found in 'new_file':

patch -p0 < my_patch.diff


[ return to main tips page ]




Comments: feedback (at) linux.org
Advertising: banners (at) linux.org
Copyright Linux Online Inc.
Compilation ©1994-2008 Linux Online, Inc.
All rights reserved.