I just took a shower and when I shut off the water it sounded like somebody on the other side of the wall was banging a jackhammer. I turned the water on and off and the noise stopped.
I told my mom upstairs and she said that her bathroom would do it when the toilet was running and the sink was turned on.
It sounds like you have a very fast closing faucet and encountered a serious case of “water hammer”, if it is for an extended time period, i.e., more than one or two bangs, then you may also have excessive pressure and the two items combined can cause damage to the piping system depending on which material it is made of.
This was the first time I heard it in the shower. I may have turned off the shower quickly. My mom showed me that it starts banging as the toilet reaches about half full and continues as the tank fills up. I have copper piping for my plumbing. Do you suggest anything?