The prohibition of keeping dogs except for dogs used for hunting, farming or herding livestock Sunan Ibn Majah 3205

Arabic hadith text
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا أَحْمَدُ بْنُ عَبْدِ اللَّهِ، عَنْ أَبِي شِهَابٍ، حَدَّثَنِي يُونُسُ بْنُ عُبَيْدٍ، عَنِ الْحَسَنِ، عَنْ عَبْدِ اللَّهِ بْنِ مُغَفَّلٍ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ ‏"‏ لَوْلاَ أَنَّ الْكِلاَبَ أُمَّةٌ مِنَ الأُمَمِ لأَمَرْتُ بِقَتْلِهَا فَاقْتُلُوا مِنْهَا الأَسْوَدَ الْبَهِيمَ وَمَا مِنْ قَوْمٍ اتَّخَذُوا كَلْبًا إِلاَّ كَلْبَ مَاشِيَةٍ أَوْ كَلْبَ صَيْدٍ أَوْ كَلْبَ حَرْثٍ إِلاَّ نَقَصَ مِنْ أُجُورِهِمْ كُلَّ يَوْمٍ قِيرَاطَانِ ‏"
Translation
It wasnarrated from ‘Abdullah bin Mughaffal that the Messenger ofAllah(ﷺ) said

“Were it not that dogs form one of the communities(ornations – of creatures), I would have commanded that they bekilled. But kill those that are all black. There are no people whokeep a dog, except for dogs used for herding livestock, hunting orfarming, but two Qirat will be deducted from their reward each day.”