The encouragement to pray the two rak'at prayer of greeting when entering the mosque

Riyad as-Salihin (The Meadows of the Righteous)

by Imam Nawawi

208. Chapter: The encouragement to pray the two rak'at prayer of greeting when entering the mosque, and it being disliked to sit down before praying the two rak'ats at whatever time one enters, whether that be the two rak'ats of greeting, or an obligatory or sunna prayer

1144. Abu Qatada reported said that the Messenger of Allah, may Allah bless him and grant him peace, said, "When one of you enters the mosque, he should not sit down until he has prayed two rak'ats." [Agreed upon]

1145. Jabir said, "I once came to the Prophet, may Allah bless him and grant him peace, while he was in the mosque and he said, 'Pray two rak'ats.'" [Agreed upon]