The Messenger of Allah ﷺ said, "When one of you comes to the mosque, let him pray two units of prayer before he sits down."
حدثنا القعنبي حدثنا مالك عن عامر بن عبد الله بن الزبير عن عمرو بن سليم الزرقي
أن رسول الله ﷺ قال إذا جاء أحدكم المسجد فليصل سجدتين من قبل أن يجلس
Bukhari transmitted it in "Prayer," chapter, "If one enters the masjid, he should pray two rak'ahs," hadith no. 444, and Muslim in "Prayer," "The Travelers," chapter, "The recommendation of greeting the masjid with two rak'ahs," etc., hadith no. 714, from the hadith of Malik through this same chain, and it is found in Muwatta (Yahya), 1/162, and (Qanabi, p. 110).