Abdullah bin Mughafal reported,

I was among those lifting the branches of the tree away from the face of the Messenger of Allah ﷺ while he was delivering a sermon. He said, "Were it not that dogs are a community among the communities, I would have ordered them all to be killed. So kill every pure black one among them. No household keeps a dog except that a qirat is deducted from their deeds each day, unless it is a dog used for hunting, farming, or guarding sheep."

Azami 5818

Sahih

عن عبد الله بن مغفل قال

إني لممن يرفع أغصان الشجرة عن وجه رسول الله ﷺ وهو يخطب، فقال: لولا أن الكلاب أمة من الأمم لأمرت بقتلها، فاقتلوا منها كل أسود بهيم. وما من أهل بيت يرتبطون كلبا إلا نقص من عملهم كل يوم قيراط، إلا كلب صيد أو كلب حرث أو كلب غنم.

الأعظمي 5818صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Sales
Chapter
Prohibited sales
Section
Prohibition of keeping dogs except for herding, hunting, or farming
Numbering
Jami al-Kamil 5818 (2nd edition)
Azami 5818