system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5-How do naval ships/subs know when a torpedo has locked on to them?

In TV and movies, during a fight scene, the people working on a ship or submarine say something along the lines of "Captain, a torpedo has locked on to us" and they can determine the distance, etc. How are they able to do that?
gpt
A torpedo uses active sonar to find the target.     It's basically blasting the party rock anthem to find you.   It's hard not to know you're the target.

A submarine navigates underwater using microphones listening to sounds.  You're listening for things that sound like propellers.    A torpedo has a really fast one.