Linux Command Cheat Sheet/Compare sorted files line-by-line

Show lines unique to each file or common to both.

Section: sed awk and Structured Text Workflows

Compare sorted files line-by-line

bash
bash
comm -3 <(sort old.txt) <(sort new.txt)
Explanation

Handy for diffing identifier lists and inventory files.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing sed awk and Structured Text Workflows
Print file contents
Concatenate and print files to standard output.
OpenIn sheetbash1 tag match
Search text with grep
Print lines matching a pattern.
OpenIn sheetbash1 tag match
Show first lines
Display the first lines of a file.
OpenIn sheetbash1 tag match
Show last lines
Display the end of a file.
OpenIn sheetbash1 tag match
Count lines words and bytes
Count content in files or streams.
OpenIn sheetbash1 tag match
Number lines
Display file contents with line numbers.
OpenIn sheetbash1 tag match