man > comm(1)

πŸ“› NAME

comm - compare two sorted files line by line

πŸš€ Quick Reference

Use CaseCommandDescription
πŸ”Ή Common lines onlycomm -12 file1 file2Suppress columns 1 & 2 (unique lines), leaving only lines present in both files
πŸ”Ή Lines unique to FILE1comm -23 file1 file2Suppress columns 2 & 3, showing lines only in FILE1
πŸ”Ή Lines unique to FILE2comm -13 file1 file2Suppress columns 1 & 3, showing lines only in FILE2
πŸ”Ή Lines unique to either file (no common lines)comm -3 file1 file2Suppress column 3 (common lines), showing lines unique to each file
πŸ”Ή Verify sorted ordercomm --check-order file1 file2Check that input files are correctly sorted
πŸ”Ή NUL‑terminated linescomm -z file1 file2Use NUL as line delimiter
πŸ”Ή Summary onlycomm --total file1 file2Output a summary of counts

πŸ“– Synopsis

comm [OPTION]... FILE1 FILE2

πŸ“ Description

Compare sorted files FILE1 and FILE2 line by line.

When FILE1 or FILE2 (not both) is -, read standard input.

With no options, produce three‑column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column three contains lines common to both files.

βš™οΈ Options

πŸ”Έ -1

suppress column 1 (lines unique to FILE1)

πŸ”Έ -2

suppress column 2 (lines unique to FILE2)

πŸ”Έ -3

suppress column 3 (lines that appear in both files)

πŸ”Έ --check-order

check that the input is correctly sorted, even if all input lines are pairable

πŸ”Έ --nocheck-order

do not check that the input is correctly sorted

πŸ”Έ --output-delimiter=STR

separate columns with STR

πŸ”Έ --total

output a summary

πŸ”Έ -z, --zero-terminated

line delimiter is NUL, not newline

πŸ”Έ --help

display this help and exit

πŸ”Έ --version

output version information and exit

Note: comparisons honor the rules specified by 'LC_COLLATE'.

πŸ“‹ Examples

comm -12 file1 file2

πŸ”Ή Print only lines present in both file1 and file2.

comm -3 file1 file2

πŸ”Ή Print lines in file1 not in file2, and vice versa.

✍️ Author

Written by Richard M. Stallman and David MacKenzie.

πŸ› Reporting Bugs

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>

©️ Copyright

Copyright Β© 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

πŸ“š See Also

join(1), uniq(1)

Full documentation <https://www.gnu.org/software/coreutils/comm>
or available locally via: info '(coreutils) comm invocation'

comm(1)
πŸ“› NAME πŸš€ Quick Reference πŸ“– Synopsis πŸ“ Description βš™οΈ Options
πŸ”Έ -1 πŸ”Έ -2 πŸ”Έ -3 πŸ”Έ --check-order πŸ”Έ --nocheck-order πŸ”Έ --output-delimiter=STR πŸ”Έ --total πŸ”Έ -z, --zero-terminated πŸ”Έ --help πŸ”Έ --version
πŸ“‹ Examples ✍️ Author πŸ› Reporting Bugs ©️ Copyright πŸ“š See Also

Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 17:27 @2600:1f28:365:80b0:f8a4:e764:d6bb:8e66
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format