Visiting Graves - Section 1 Mishkat al-Masabih 1764
Arabic hadith text
وَعَنْ بُرَيْدَةَ قَالَ: كَانَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يُعَلِّمُهُمْ إِذَا خَرَجُوا إِلَى الْمَقَابِرِ: «السَّلَامُ عَلَيْكُمْ أَهْلَ الدِّيَارِ مِنَ الْمُؤْمِنِينَ وَالْمُسْلِمِينَ وَإِنَّا إِنْ شَاءَ اللَّهُ بِكُمْ لَلَاحِقُونَ نَسْأَلُ اللَّهَ لَنَا وَلَكُمُ الْعَافِيَةَ» . رَوَاهُ مُسْلِمٌ
Translation
Buraida said that God's messenger used to teach them to say when they went out to the cemeteries, “Peace be upon you, inhabitants of the dwellings who are of the number of the believers and the Muslims. If God will, we shall join you. We ask God to grant us and you wellbeing.” Muslim transmitted it.