College of Arts and Sciences

Department of Mathematics

Diff - using the diff command

Use the diff command to compare two files and output a difference report.
To compare the files 'manuscript.old' and 'manuscript.new,' type:

diff manuscript.old manuscript.new

Use the redirect command to save the difference to a new file:

diff manuscript.old manuscript.new > manuscript.diff

Use sdiff instead of diff to view the files in a "different" manner.
To peruse the files 'laurel' and 'hardy' side by side on the screen:

sdiff laurel hardy | less

To output the difference between three separate files, use diff3 and redirect the ouptput to another file:

diff3 larry curly moe > stooges
Department of Mathematics, PO Box 643113, Neill 103, Washington State University, Pullman WA 99164-3113 Phone: 509-335-3926 Fax: 509-335-1188 Contact Us