Sayyiduna Ka'b bin Ujrah (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings be upon him) saw me while my lice were falling onto my face, and said: "Are these lice of yours troubling you?" I said: Yes. So he (peace and blessings be upon him) ordered me to shave my head while we were at al-Hudaybiyah, and at that time it was not clear that we would shave our heads there, as we were hoping to enter Makkah. Then Allah, the Mighty and Majestic, revealed the verse of ransom, and the Messenger of Allah (peace and blessings be upon him) ordered me to feed one faraq to six poor people, or to fast three days, or to slaughter a goat.
Hadith Referenceالمعجم الكبير للطبراني / باب الكاف / 16279