The Book of Virtues

Riyad as-Salihin · Chapter 208

Inducement to Perform Tahiyyat-ul-Masjid (Upon Entering the Mosque)

باب الحث على صلاة تحية المسجد بركعتين وكراهية الجلوس قبل أن يصلي ركعتين في أي وقت دخل سواء صلى ركعتين بنية التحية أو صلاة فريضة أو سنة راتبة أو غيرها‏:‏

This brief chapter encourages a small prayer of two units upon entering the mosque, a way of greeting the house of Allah before sitting down.

The hadith show the Prophet teaching this directly, even telling a man already present to stand and pray it. The thread is a gentle courtesy toward the mosque, beginning one's time there with worship.

Hadith 1144

Abu Qatadah (May Allah be pleased with him)reported:

وعن أبي قتادة رضي الله عنه قال‏:‏ قال رسول الله صلى الله عليه وسلم‏:‏ ‏ "‏ إذا دخل أحدكم المسجد فلا يجلس حتى يصلي ركعتين‏" ‏‏.‏ ‏(‏‏(‏متفق عليه‏)‏‏)‏‏.‏

The Messenger of Allah (ﷺ) said, "When anyone of you enters the mosque, he should perform two Rak'ah (of voluntary prayer) before sitting." [Al-Bukhari and Muslim].

In plain words

The Prophet taught that whenever someone enters the mosque, he should pray two units before sitting down, a simple way of honoring the place of worship on arrival.

Reference : Riyad as-Salihin 1144 In-book reference : Book 8, Hadith 154

Hadith 1145

Jabir (May Allah be pleased with him) reported:

وعن جابر، رضي الله عنه قال‏:‏ أتيت النبي صلى الله عليه وسلم وهو في المسجد فقال‏:‏ ‏ "‏صلِ ركعتين‏" ‏ ‏(‏‏(‏متفق عليه‏)‏‏)‏‏.‏

I came to the Prophet (ﷺ) when he was in the mosque, and he said to me, "Perform two Rak'ah prayer." [Al-Bukhari and Muslim].

In plain words

When Jabir came to the Prophet in the mosque, the Prophet told him to pray two units, showing the practice of greeting the mosque with a short prayer.

Reference : Riyad as-Salihin 1145 In-book reference : Book 8, Hadith 155