Tuesday, February 16, 2021

Smart ways to compare files on Linux

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.

diff

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
10,12c10
< 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 < and those only in the second file with >.

To read this article in full, please click here


Thanks to Sandra Henry-Stocker (see source)

No comments:

Post a Comment