comm is a useful Linux tool to use at the shell. It takes two files with sorted lines as input and displays which lines are unique to each file and which lines are common (intersection) to both. For example, this might be useful when comparing which files are common among two directories and so on. This tool is a part of coreutils package, so it should be available everywhere.
$ comm first.txt second.txt
You will see 3 columns in the output corresponding to lines unique to first file, lines unique to second file and lines common to both.
$ comm -1 -2 first.txt second.txt
Tried with: Ubuntu 16.04