Forrest logo
back to the comm tool

comm:tldr:f33d6

comm: Print only lines common to both files.
$ comm -12 ${file1} ${file2}
try on your machine

The command "comm -12 ${file1} ${file2}" compares and displays the lines that are common between two sorted files (${file1} and ${file2}). Here is the breakdown of the command:

  • "comm": It is a command-line utility in Unix and Unix-like operating systems that compares two sorted files line by line.
  • "-12": This option is used to suppress the output of lines that are unique to either file. It only displays the lines that are common between both files.
  • "${file1}": It represents the first file that you want to compare.
  • "${file2}": It represents the second file that you want to compare.

So, in summary, this command compares the contents of two sorted files and prints out only the lines that are common to both files.

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