Two copies of a meeting note have almost the same filename. One says the room opens at noon and the other contains a later correction. Comparing the text line by line makes it easier to carry the right detail into the agenda.
Open manual and terminal · AI-generated editorial illustration
תקציר בעברית
שתי גרסאות של סיכום פגישה נראות זהות במבט ראשון. השוו אותן בטרמינל ולמדו כיצד סדר הקבצים בפקודה קובע אילו שורות יסומנו כתוספות ואילו כהשמטות.
Make two small versions
In a new practice folder, use your editor to save yesterday.txt as plain text. Give it three separate lines reading “Doors open at noon.”, “Bring the printed list.” and “Use the east entrance.” Save another file called today.txt with the same three lines, then change noon to one in the first line. Leave the other two lines alone. Open a terminal in the folder with both notes so that the filenames refer to these practice documents. Read the diff manual.
Read the change in order
Enter diff -u './yesterday.txt' './today.txt'. At the top are two file headers identifying the earlier and later inputs. Farther down, a line beginning with a single minus shows the old sentence about noon. A line beginning with a single plus shows the replacement sentence about one. The following lines supply enough unchanged context to recognise the meeting. The @@ line describes locations in both files. You can usually start with the changed sentences and consult those locations as needed.
Open manual and terminal · AI-generated editorial illustration
Reverse the comparison
Run the same command with the two filenames swapped. Notice how the plus and minus signs change sides. Their meaning follows the order of the arguments. This is why a date in each filename can be more useful than labels like final and final again. For another quick check, compare yesterday.txt with itself. No differences appear. The program shows differences when they exist and leaves identical text quiet.
Resolve the editorial question
A comparison proves that the sentence changed. It cannot tell you whether the organiser approved the new time. Open your source message or ask the person who owns the agenda before copying the correction. If your notes contain entire paragraphs on a single line, a tiny edit can produce a large block of output because the comparison works line by line. A separate line per decision makes future reviews easier and helps the next reader identify which commitment changed. For further reading, browse command line for beginners books.
Before you begin
Which input is described by the single plus lines?
Check your result
The second file in the command supplies the added lines. In the first comparison that is today.txt.
You remember putting the pickup instructions in a text file. The date, the filename and the folder have slipped your mind. What stayed with you is the phrase “blue envelope.” That fragment is enough to make a small, repeatable search.
A friend asks for the handout you prepared last month. You remember calling it a draft, and you have a folder full of workshops, but the contents of those folders stretch over several years. Search the names before opening every document.
Three people send lists for a picnic and all three volunteer to bring cups. Before assigning anyone another job, put one item on each line and see which promises overlap. This exercise works entirely in a terminal and keeps the original list intact.
Allow Google Analytics to measure article visits, shares and merchant clicks?