YouTip LogoYouTip

Linux Comm Comm

# Linux comm Command [![Image 3: Linux Command Manual](#) Linux Command Manual](#) The Linux `comm` command is used to compare two sorted files. This command compares two sorted files column by column and displays the results. If no parameters are specified, the output is divided into three columns: the first column contains lines only present in the first file, the second column contains lines only present in the second file, and the third column contains lines present in both files. If the filename is given as `-`, `comm` reads from standard input. ### Syntax comm **Parameters**: * -1 Suppress lines unique to the first file. * -2 Suppress lines unique to the second file. * -3 Suppress lines common to both files. * --help Display online help. * --version Display version information. ### Example The contents of `aaa.txt` and `bbb.txt` are as follows: [root@localhost text]# cat aaa.txt aaa bbb ccc ddd eee 111 222[root@localhost text]# cat bbb.txt bbb ccc aaa hhh ttt jjj Executing the `comm` command produces the following output: [root@localhost text]# comm aaa.txt bbb.txt aaa bbb ccc aaa ddd eee 111222 hhh ttt jjj First column Second column Third column The first column of the output contains only lines present in `aaa.txt`, the second column contains lines present in `bbb.txt`, and the third column contains lines present in both `aaa.txt` and `bbb.txt`. The columns are delimited by the tab character `t`. [![Image 4: Linux Command Manual](#) Linux Command Manual](#)
← Linux Comm CsplitLinux Comm Colrm β†’