background
|
|
News
All in one Place
All of your regular news in one place.
More icon

Computer
|
|
Up Image
Navigation
Search this Site
Enter your search terms

Site Breadcrumb - You are here
|
Reference   Unix Guide

diff

diff displays the lines that differ between two given files.

Structure: diff [options] [directory options] file1 file2

diff can be an extremely valuable tool for both checking errors and building new pages. If you run a diff between two files, you'll be shown what differences the files have line by line. The lines referring to file1 are marked with the < symbol. The lines referring to file2 are marked by the > symbol. If the file is a directory, diff will list the file in the directory that has the same name as file2. If both of the files are directories, diff will list all the lines differing between all files that have the same name.

If you have a file that is not working properly, it can be a great help to check it against a similar file that is working. It will often quickly alert you to a line of code that's missing.

A handy option to use if you want to generally compare two files without noting the complex differences between them is the -h option (h stands for half-hearted). Using -i as an option will ignore differences in uppercase and lowercase characters between files, and -b will ignore repeating blanks and line breaks.

Back to the index.