When any one of you enters the mosque, he should observe two rak'ahs (of Nafl prayer)…

Sahih Muslim Book 6 Hadith 84

Sahih Muslim #714 a

The Book of Prayer - Travellers 6:84

Abu Qatada (a Companion of the Prophet) reported Allah's Messenger (ﷺ) as saying:

When any one of you enters the mosque, he should observe two rak'ahs (of Nafl prayer) before sitting.

Chapter: It is recommended to greet the masjid by praying two rak`ah, and it is disliked to sit before praying these two rak`ah, and this is prescribed at all times

Grade: Sahih