To tear sb. a new one?

does anyone know this:to tear sb. a new one?and what does it mean?
thank you for your help!

I've only heard the first part "to tear sb", meaning to vigorously criticise someone (often behind their back). I think it comes from "tearing strips off someone". But this doesn't make sense in the context of "to tear sb a new one". Pamela

The full version used in a sentence would be: I'm so mad at you that I'm going "to tear/rip you a new *sshole". Not meant literally, but it is a threat of violence.

Not literal at all... but it does promise a severe verbal reprimand that will feel like gaining a new sphincter.