How to cut a body with another body in a part

I have made a body which intersects another:

As you can see, the green body goes into the grey one and out the other side (the grey shape is hollow). What I want to do is cut the green body with the grey one so that only the outside part of the green body remains. I remember there was a simple way to do this, but I can't remember exactly how.

SolidworksParts And Features