When you enter a room, first greet everyone inside. If you want to shake hands with those present, begin with the most knowledeable, the most pious, the older or those who have similar Islamic distinctions. Do not overlook the most distinguished or most eminent and start with the first on your right. If you cannot decide who is the most reputable, or if those present happen to be of similar status, start with the elderly, for they are easier to recognise.
Rasulullah [Sallallahu álayhi wa sallam] said, “Exalt the elderly, exalt the elderly.” [Sahih Bukhari and Sahih Muslim]
Imam Abu Ya’lá and At-Tabaráni [Rahimahumullah] in Al-Awsat reported that Rasulullah [Sallallahu álayhi wa sallam] said, “Start with the notables.” or, he said, “with the elder.” [Sahih Bukhari]