0% found this document useful (0 votes)
4 views1 page

Checking The Difference

The document explains how to use the diff command in Bash and Z Shell to compare the contents of two files. It details the meanings of the output symbols, such as d for delete, c for change, and a for append, along with options for context and unified modes. This command is useful for identifying differences and making necessary adjustments between files.

Uploaded by

akym
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Checking The Difference

The document explains how to use the diff command in Bash and Z Shell to compare the contents of two files. It details the meanings of the output symbols, such as d for delete, c for change, and a for append, along with options for context and unified modes. This command is useful for identifying differences and making necessary adjustments between files.

Uploaded by

akym
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

"Managing Files Using Bash and Z Shell" course by Mateo Prigl at Pluralsight

Checking the Difference


You can check the difference between the content of two files with the diff
command.

$ diff first_file second_file

This will print out all of the differences between the first and the second file.
There will also be a short instructions on how you can make the first file look
like the second one.
d means delete this line from the first file. Which line you need to delete will be
shown by a line number before the letter. c means change the line from the first
file with one from the second file.
a means append this line to the first file.
These lines that the commands are refering to will be shown under them. If the
line starts with < that means that it belongs to the first file. The > will prepend
the lines that belong to the second file.
There is also a c option, which is the context mode. This mode will print out
some range of lines from both files. Lines that start with + will need to be
added to the first file. - lines will need to be removed.
There are also the ! lines which need to be changed to the appropriate ! line
from the second file.
u option enables the unified mode. It looks similar to the context mode, but it's
showing both of the files connected in one range of lines.

1/1 © Copyright 2020 by Pluralsight

You might also like