We can use comm
to find lines in one file but not in another file
# fine lines only in file-a
comm -23 file-a file-b
From comm --help
,
-2 suppress column 2 (lines unique to FILE2)
-3 suppress column 3 (lines that appear in both files)
So to find lines exist in both file-a and file-b.
comm -12 file-a file-b
Google keywords: “linux command two file not contain” hit link