Abu Saaib reported,

He came to visit Abu Saeed Khudri, and he said, "While I was sitting with him, I heard something moving beneath his bed. I looked, and there was a snake. So I stood up."Abu Saeed asked, "What is the matter with you?"I said, "There is a snake here."He asked, "What do you intend to do?"I said, "I will kill it."Then he pointed toward a room in his compound, facing his own room, and said, "A cousin of mine used to live in this room. On the day of the Ahzab he asked permission to go to his family, for he was newly married, and the Messenger of Allah ﷺ gave him permission and instructed him to take his weapon with him. He came to his home and found his wife standing at the door of the room, so he raised his spear at her.She said, "Do not be hasty until you see what drove me out."So he entered the room, and there was a hideous snake. He drove the spear into it, then came out with it writhing on the spear. Abu Saeed said, "I do not know which of the two died more quickly, the man or the snake."His people came to the Messenger of Allah ﷺ and said, "Pray to Allah to bring our companion back."He said, "Seek forgiveness for your companion." Then he said, "A group of the jinn have accepted Islam in Madinah. So if you see one of them, warn it three times, and if after that you still wish to kill it, then kill it after the three warnings."A fuller version has, "Give it notice for three days, and if after that you still wish to kill it, then kill it, for it is only a devil."

Abu Dawud 5259

Sahih

حدثنا أحمد بن سعيد الهمداني أخبرنا ابن وهب قال أخبرني مالك عن صيفي مولى ابن أفلح قال أخبرني أبو السائب مولى هشام بن زهرة أنه دخل على أبي سعيد الخدري فذكر نحوه وأتم منه قال فآذنوه ثلاثة أيام فإن بدا لكم بعد ذلك فاقتلوه فإنما هو شيطان

أبو داود 5259صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Manners
Chapter
Killing snakes
Numbering
Darussalam 5259
Abu Dawud 5259