It is narrated from Hazrat Ka'b bin Ujrah (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) saw me while lice were falling onto my face, and said, "Are these vermin troubling you?" I replied, "Yes!" So the Noble Prophet (peace and blessings be upon him) ordered me to shave my head. At that time they were at Hudaybiyyah, and the Noble Prophet (peace and blessings be upon him) had not yet made clear to them that they would shave there, and they were hoping to enter Makkah. Then Allah Almighty revealed the ruling of ransom (fidyah), so the Noble Prophet (peace and blessings be upon him) ordered me to distribute one faraq (three sa') of food among six needy people, or to fast three days, or to slaughter a goat.
Hadith Referenceمسند احمد / أول مسند الكوفيين / 18113