Sahih al-Bukhari — Hadith 6006 (KitabGrid sequence)
Narrated Sahl bin Sa`d:
حَدَّثَنَا عَلِيُّ بۡنُ عَبۡدِ اللَّهِ، حَدَّثَنَا سُفۡيَانُ، قَالَ الزُّهۡرِيُّ حَفِظۡتُهُ كَمَا أَنَّكَ هَا هُنَا عَنۡ سَهۡلِ بۡنِ سَعۡدٍ قَالَ اطَّلَعَ رَجُلٌ مِنۡ جُحۡرٍ فِي حُجَرِ النَّبِيِّ صلى الله عليه وسلم وَمَعَ النَّبِيِّ صلى الله عليه وسلم مِدۡرًى يَحُكُّ بِهِ رَأۡسَهُ فَقَالَ
" لَوۡ أَعۡلَمُ أَنَّكَ تَنۡظُرُ لَطَعَنۡتُ بِهِ فِي عَيۡنِكَ، إِنَّمَا جُعِلَ الاِسۡتِئۡذَانُ مِنۡ أَجۡلِ الۡبَصَرِ ".
Translation
Ali ibn Abdullah narrated to us: Sufyan narrated to us: Al-Zuhri said, “I memorized it as surely as you are here,” from Sahl ibn Sa'd رضي الله تعالى عنه, who said:
A man peered through a hole into the chambers of the Prophet صلى الله عليه وآله وسلم, who had a pointed hair implement with which he was scratching his head. He said, “Had I known that you were looking, I would have thrust it into your eye. Permission to enter was instituted because of the gaze.”