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 a

Arabic hadith text
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، قَالَ قَرَأْتُ عَلَى مَالِكٍ عَنْ نَافِعٍ، عَنِ ابْنِ عُمَرَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏مَنِ اقْتَنَى كَلْبًا إِلاَّ كَلْبَ مَاشِيَةٍ أَوْ ضَارِي نَقَصَ مِنْ عَمَلِهِ كُلَّ يَوْمٍ قِيرَاطَانِ ‏"
Translation
Ibn Umar (Allah be pleased with him) reported Allah's Messenger (ﷺ) as saying

He who keeps a dog other than that meant for watching the herd or for hunting loses every day out of his deeds equal to two qirat.