O'Reilly logo

Practical UNIX by Steve Moritsugu - DTR Business Systems

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Comparing Files

UNIX uses simple text files in a variety of important roles, including system configuration tables, C program source code, HTML Web pages, and user data. Because text files have so many important uses under UNIX, several different UNIX utilities enable you to compare text files and see their differences. To compare binary, non-text files, other commands can be used.

Showing Differences Between Two Files

To show the differences between two text files, use this command:

diff file1 file2

287c287 in diff Output

For the beginner, remember no news is good news. If diff shows no output, the files are identical. Any diff output means the files are different. The more output, the more lines that are different. In the example, you see ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required