(33) باب احْتِسَابِ الآثَارِ
Narrated Humaid:
Anas said, "The Prophet (ﷺ) said, 'O Bani Salima! Don't you think that for every step of yours (that you take towards the mosque) there is a reward (while coming for prayer)?" Mujahid said: "Regarding Allah's Statement: "We record that which they have sent before (them), and their traces" (36.12). 'Their traces' means 'their steps.' " And Anas said that the people of Bani Salima wanted to shift to a place near the Prophet (ﷺ) but Allah's Messenger (ﷺ) disliked the idea of leaving their houses uninhabited and said, "Don't you think that you will get the reward for your footprints." Mujahid said, "Their foot prints mean their foot steps and their going on foot."
Reference: Sahih al-Bukhari 655, 656
In-book reference: Book 10, Hadith 50
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 1, Book 11, Hadith 625