عن أبي هريرة رضي الله عنه مرفوعاً: "لِيُسَلِّمِ الصغيرُ على الكبيرِ، والمارُّ على القاعدِ، والقليلُ على الكثيرِ" وفي رواية: "والراكبُ على الماشي". [صحيح] - [متفق عليه] المزيــد ...
Abu Hurayrah (may Allah be pleased with him) reported that the Prophet (may Allah's peace and blessings be upon him) said: "The young should greet the old, the passer-by should greet the one who is sitting, and the small group of people should greet the larger one." Another narration adds: "and the one who is riding should greet the one who is walking." Sahih/Authentic. - [Al-Bukhari and Muslim]
This Hadīth explains the recommended order of who should start with greeting the other. It mentioned four types:
1. The younger person greets the older one out of respect for him.
2. The walking person should start with greeting the sitting person because he is like the one coming to him.
3. The larger group takes precedence over the smaller group, so it is better that the smaller group greets the larger one first.
4. The one who is riding is favored with the blessing of having something to ride, so his starting with greeting the one walking is kind of showing gratitude to Allah for His favor.