Jabir bin Abdullah reported,

The tribe of Banu Salama wanted to relocate closer to the mosque, as the surrounding areas were empty. When news of this reached the Prophet ﷺ, he said, "Banu Salama, stay in your homes, for your footsteps are recorded."They replied, "Nothing would have pleased us more than to have moved, but now we no longer wish to."

Muslim 1520

Sahih

حدثنا عاصم بن النضر التيمي حدثنا معتمر قال سمعت كهمسا يحدث عن أبي نضرة

عن جابر بن عبد الله قال

أراد بنو سلمة أن يتحولوا إلى قرب المسجد قال والبقاع خالية فبلغ ذلك النبي ﷺ فقال يا بني سلمة دياركم تكتب آثاركم فقالوا ما كان يسرنا أنا كنا تحولنا

مسلم 1520صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Mosques and places of prayer
Chapter
Virtue of taking many steps to the mosques
Numbering
Darussalam 1520
Muslim 1520