how to find out overlaped content

i have two single column text files a and b. in this two files, there are some overlap content, is there any quick way I can find out those overlapped content?

example, file a

1
2
3
4
5
6

file b
2
35
7
8
4

2 and 4 are overlapped in these two files so they should be picked up.

Use grep, something like:

grep -f file1 file2

Regards

sort -n file1 > sorted1
sort -n file2 > sorted2
comm -12 sorted1 sorted2

Building on shamrock's answer, you could merge this into one line if you're running bash:

comm -12 <(sort file_a) <(sort file_b)

The <( ) construct creates a temporary file out of the output of the command(s) inside the parens.

/fimblo