diff

Displays the differences between two files

diff [options] file1 file2

diff [options] file1 directory

diff [options] directory file2

diff [options] directory1 directory2

The diff utility displays line-by-line differences between two files. By default diff displays the differences as instructions that you can use to edit one of the files to make it the same as the other.

Arguments

The file1 and file2 are pathnames of the files that diff works on. When the directory2 argument is used in place of file2, diff looks for a file in directory2 with the same name as file1. Similarly, when the directory argument is used in place of file1, diff looks for a file in directory1 with the same name as file2. You can use a hyphen in place of file1 or

Get A Practical Guide to Red Hat® Linux® 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.