Linux compares different output content of files. Currently, I know the following methods to compare the rows of two files to output their differences: 1) comm mission: comm [-123] file1 file2 [> sfile] NOTE: file1, file2 must be firstly sorted! -1/2/3 means:-1 ----- rid the only retained contents in file1-2 ----- rid the only retained contents in file2-3 ----- rid the communal lines in both two files, as mentioned above, the premise for using the comm command is to address two sorted files! This command compares two sorted files. File1 and file2 are sorted files. Comm reads the two files and generates three output columns: only the rows that appear in file1, only the rows that appear in file2, And the rows that exist in both files. If the file name is "-", it indicates reading from the standard input. Option 1, 2, or 3 suppress the corresponding column display. For example, comm-12 only shows the rows that exist in both files; comm-23 only shows the rows that appear in the first file but not in the second file; comm-123 then nothing is displayed. 2) grep mission: grep-v-f file1 file2/* Note: This method compares the result when comparing numbers. We do not recommend using this method for text comparison */3) awk mission: awk '{print NR, $0}' file1 file2 | sort-k2 | uniq-u-f 1 | sort-k1 | awk '{print $2}' or: awk '{print $0}' file1 file2 | sort | uniq-u 4) diff mission: diff [-opt] file1 file2