From the course: Linux Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Using diff to compare files

Using diff to compare files - Linux Tutorial

From the course: Linux Tips

Using diff to compare files

- [Narrator] At the command line, it's useful to compare files either to find out if they're duplicate copies or to find differences between configuration files, source code, or other files. To do this, we can use the diff utility, which is available on nearly all Linux distributions and on Mac OS. Diff takes two files which it thinks of as the left-file and the right-file and compares them line by line, reporting the differences. I have a few files here on my system containing lists of different kinds of fruit. The files have minor differences from each other and if you'd like to follow along, pause here and create these plain text files for yourself. When you're ready, let's take a look at the basics of using diff to find those differences. If there are no differences between the files, diff returns nothing. Let's compare file1 to itself and there's no differences. Now, let's compares two different files. I'll…

Contents