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 b

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

He who kept a dog other than one meant for hunting or for watching the herd, lost two qirat of his reward every day.