(11) باب اسْتِحْبَابِ تَحِيَّةِ الْمَسْجِدِ بِرَكْعَتَيْنِ وَكَرَاهَةِ الْجُلُوسِ قَبْلَ صَلاَتِهِمَا وَأَنَّهَا مَشْرُوعَةٌ فِي جَمِيعِ الأَوْقَاتِ
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. (ES)
Reference (ES): Sahih Muslim 714 a (ES)
In-book reference (ES): Book 6, Hadith 84 (ES)
USC-MSA web (English) reference(deprecated numbering scheme): Book 4, Hadith 1540 (ES)