Sahih al-Bukhari 3312, 3313Book 59, Hadith 119
حَدَّثَنَا مَالِكُ بْنُ إِسْمَاعِيلَ، حَدَّثَنَا جَرِيرُ بْنُ حَازِمٍ، عَنْ نَافِعٍ، عَنِ ابْنِ عُمَرَ، أَنَّهُ كَانَ يَقْتُلُ الْحَيَّاتِ. فَحَدَّثَهُ أَبُو لُبَابَةَ، أَنَّ النَّبِيَّ صلى الله عليه وسلم نَهَى عَنْ قَتْلِ جِنَّانِ الْبُيُوتِ، فَأَمْسَكَ عَنْهَا.
Ibn `Umar used to kill snakes but when Abu Lubaba informed him that the Prophet (ﷺ) had forbidden the killing of snakes living in houses, he gave up killing them.