عن أبي قتادة السَّلَمي أن رسول الله صلى الله عليه وسلم قال: «إذا دخل أحدكم المسجد فليركع ركعتين قبل أن يجلس».
[صحيح] - [متفق عليه]
المزيــد ...

Abu Qatādah as-Salami (may Allah be pleased with him) reported that the Prophet (may Allah’s peace and blessings be upon him) said: "When anyone of you enters the mosque, let him offer two Rak‘ahs before he sits down."
Sahih/Authentic. - [Al-Bukhari and Muslim]

Explanation

Abu Qatādah (may Allah be pleased with him) reported that the Prophet (may Allah’s peace and blessings be upon him) said: When anyone of you enters the mosque, let him offer two Rak‘ahs. So, one cannot fulfill this act of Sunnah by less than two Rak‘ahs. The Prophet's command to offer this prayer, known as the greeting to the mosque, was given by way of encouragement and desirability. This supererogatory prayer ceases to be required if a person offers the obligatory prayer upon entering the mosque, like when he enters and finds people in prayer and he joins them. Some cited the words "before he sits down" to say that if a person contradicts this and actually sits down, he may not stand up to offer these two Rak‘ahs. The correct view, however, is that they remain valid for him, and he may rise and offer them, as indicated by a Hadīth relating that a man entered the mosque and sat down. Thereupon, the Prophet (may Allah’s peace and blessings be upon him) asked him: "Have you offered two Rak‘ahs?" As the man replied in the negative, the Prophet (may Allah’s peace and blessings be upon him) said to him: "Stand up and offer them" [Narrated by Muslim]. So, the Prophet (may Allah’s peace and blessings be upon him) instructed that this prayer be offered before sitting down, and he instructed whoever sat down without praying to stand up and pray.

Translation: French Turkish Urdu Indonesian Bosnian Bengali Chinese Persian Indian Vietnamese Sinhala Uyghur Kurdish Hausa Malayalam Swahili Tamil Burmese Thai Pashto Assamese Albanian Swedish amharic Dutch Gujarati Dari
View Translations

Benefits from the Hadith

  1. The Hadīth demonstrates the Sunnah of praying upon entering the mosque.
  2. It informs that the greeting of the mosque consists of two Rak‘ahs.
  3. This command apparently applies to those who enter and want to sit down, not those who enter the mosque and leave it before sitting down.
  4. The greeting of the mosque is fulfilled by offering an obligatory prayer.