Commands for comparing files have proliferated since the early days of Linux. In this post, we’ll look at a suite of commands available for comparing files and highlight the advantages that some of the newer ones provide.
One of the oldest and still popular commands for detecting and reporting on file differences is the diff command. Comparing two lists of meeting attendees, the diff command will simply and clearly show you the differences.
$ diff attendance-2020 attendance-2021
< Monroe Landry
< Jonathon Moody
< Donnell Moore
> Sandra Henry-Stocker
Only the lines that are different are displayed. The output precedes lines that are only in the first file with .
Source:: Network World – Linux