Forrest logo
back to the comm tool

comm:tldr:900ee

comm: Produce three tab-separated columns: lines only in first file, lines only in second file and common lines.
$ comm ${file1} ${file2}
try on your machine

The command "comm ${file1} ${file2}" is used to compare two sorted files line by line. Here's what each element of the command does:

  • "comm" is the command itself, which is short for "compare."
  • "${file1}" and "${file2}" are variables representing the file names or paths of the two files that you want to compare.

The "comm" command compares the contents of the two files and produces three columns as output:

  • The first column contains lines that are unique to "${file1}".
  • The second column contains lines that are unique to "${file2}".
  • The third column contains lines that are present in both files.

By default, the output is sorted in ascending order. The command can be customized with options to modify the behavior, such as specifying a different sort order, ignoring whitespace differences, or suppressing certain columns in the output.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the comm tool