Abu Uthman narrates that Sayyiduna Ibn Mas'ud (may Allah be pleased with him) heard a man announcing a lost item in the mosque, so he became very angry and rebuked him harshly. Then a person said to him, "O Ibn Mas'ud, you were not one to use foul language?" He replied, "We were commanded to act in this manner (on such occasions)."
Hadith Referenceصحيح ابن خزيمه / جماع أبواب فضائل المساجد وبنائها وتعظيمها / 1303