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 f

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

Whosover amongst the owners of the house keeps a dog other than one meant for watching the herd or for hunting loses two qirat of his deeds every day.