COMM(1)
π COMM(1) π
okay bestie, gather round, because we're about to talk about comm, the general commands manual's most underrated little icon β¨
πΈ NAME πΈ
comm β compare two sorted files line by line, fr fr.
When FILE1 or FILE2 (but like, not both, bestie) is -, read standard input. π«Ά
With no options at all, you get three-column output, and here's the tea: column one has the lines that are unique to FILE1, column two has the lines unique to FILE2, and column three is the lines that are common to both files. main character behavior honestly π
β¨ SYNOPSIS β¨
comm [OPTION]... FILE1 FILE2
π¦ DESCRIPTION π¦
So the whole vibe is: compare two sorted files line by line. That's it. That's the job. π
When FILE1 or FILE2 (again, not both, pick a lane) is -, read standard input.
With no options, produce three-column output:
- column one = lines unique to
FILE1 - column two = lines unique to
FILE2 - column three = lines that are common to both files
π OPTIONS π
-1β suppress column 1, aka the lines unique toFILE1. bye bestie π-2β suppress column 2, aka the lines unique toFILE2. also gone π-3β suppress column 3, aka the lines that appear in both files. not them being erased π--output-delimiter <STR>β separate the columns withSTR. you pick the little separator, it's giving customizable π¨-z,--zero-terminatedβ line delimiter isNUL, not newline. yes literally the NUL character, we're being fancy β¨--totalβ output a summary. little recap moment, we love a summary π§Ύ--check-orderβ check that the input is correctly sorted, even if all input lines are pairable. nosy but in a helpful way π--nocheck-orderβ do not check that the input is correctly sorted. minding my own business energy π-h,--helpβ print help π-V,--versionβ print version β<FILE1>β the first file, the file one, the original π<FILE2>β the second file, the sequel, the encore πΈ
π VERSION π
v(uutils coreutils) 0.12.0
π₯ EXAMPLES π₯
Produce three tab-separated columns: lines only in first file, lines only in second file, and common lines:
comm file1 file2
Print only lines common to both files:
comm -12 file1 file2
Print only lines common to both files, reading one file from stdin:
cat file1 | comm -12 - file2
Get lines only found in first file, saving the result to a third file:
comm -23 file1 file2 > file1_only
Print lines only found in second file, when the files aren't sorted:
comm -13 <(sort file1) <(sort file2)
bestie, real talk: these examples are provided by the tldr-pages project at https://tldr.sh under the CC BY 4.0 License. And please note that, because uutils is a work in progress, some examples might fail. no cap, it's a WIP π§
π SIGN-OFF π
this page is from v(uutils coreutils) 0.12.0, dated 2026-09-25, and it lives in the General Commands Manual, section 1, COMM(1). slay, go sort your files, periodt π
β¨
π¦ where this page comes from
- ubuntu stonking: rust-coreutils 0.12.0-1ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms