The command to kill dogs, and its abrogation. The prohibition of keeping dogs, except for hunting, farming, (herding) livestock and the like Sahih Muslim 1574 d

Arabic hadith text
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، وَيَحْيَى بْنُ أَيُّوبَ، وَقُتَيْبَةُ، وَابْنُ، حُجْرٍ قَالَ يَحْيَى أَخْبَرَنَا وَقَالَ الآخَرُونَ، حَدَّثَنَا إِسْمَاعِيلُ، عَنْ مُحَمَّدٍ، - وَهُوَ ابْنُ أَبِي حَرْمَلَةَ - عَنْ سَالِمِ بْنِ عَبْدِ، اللَّهِ عَنْ أَبِيهِ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏مَنِ اقْتَنَى كَلْبًا إِلاَّ كَلْبَ مَاشِيَةٍ أَوْ كَلْبَ صَيْدٍ نَقَصَ مِنْ عَمَلِهِ كُلَّ يَوْمٍ قِيرَاطٌ ‏"‏ ‏.‏ قَالَ عَبْدُ اللَّهِ وَقَالَ أَبُو هُرَيْرَةَ ‏"‏ أَوْ كَلْبَ حَرْثٍ
Translation
Salim b. 'Abdullah reported on the authority of his father that Allah's Messenger (ﷺ) said

He who kept a dog other than one meant for watching the herd or for hunting would lose every day two qirat of his good deeds. 'Abdullah and Abu Huraira also said: Or dog meant for watching the field.