Sahih Muslim 2380 c
Ubayy b. Ka'b narrated to us that he had heard Allah's Messenger (ﷺ) as saying:
Moses had been delivering sermons to his people. And he made this remark: No person upon the earth has better knowledge than I or nothing better than mine. Thereupon Allah revealed to him: I know one who is better than you (in knowledge) or there is a person on the earth having more knowledge than you. Thereupon he said: My Lord, direct me to him. It was said to him: Keep a salted fish as a provision for journey. The place where that fish would be lost (there you will find that man). So he set forth and a young slave along with him until they came to a place Sakhra. but he did not find any clue. So he proceeded on and left that young man there. The fish began to stir in water and the water assumed the form of an ark over the fish. The young man said: I should meet Allah's Apostle (peace be upon him) and inform him, but he was made to forget and when they had gone beyond that place, he (Moses) said to the young man: Bring breakfast. We have been exhausted because of the journey, and he (Moses) was not exhausted until he had crossed that (particular) place (where he had) to meet Khadir, and the youth was reminded and said: Did you not see that as we reached Sakhra I forgot the fish and it is satan alone who has made me forgetful of it'? It is strange that he has been able to find way in the ocean too. He said: This is what we sought for us. 
They returned retracing their steps, and he (his companion) pointed to him the location (where) the fish (had been lost). Moses began to search him there. He suddenly saw Khadir wrapped in a cloth and lying on his back. He said to him: As-Salamu-'Alaikum. He removed the cloth from his face and said: Wa 'Alaikum-us-Salam! Who are you? He said: I am Moses. He said: Who Moses? He said: Moses Of Bani Isra'il. He said: What brought you here? He said: I have come so that you may teach me what you have been taught of righteousness. He said: You shall have to bear with me, and how can you have patience about a thing of which you have no comprehensive knowledge? You will not have patience when you see me doing a thing I have been ordered to do. He said: If Allah pleases, you will find me patient, nor shall I disobey you in aught. Khadir said: If you follow me, don't ask me about anything until I explain it to you. So they went on until they embarked upon a boat. He (Khadir) made a hole in that. Thereupon he (Moses) said: You have done this so that you may drown the persons sitting in the boat. You have done something grievous. Thereupon he said: Did I not tell you that you will not be able to bear with me? Thereupon he (Moses) said: Blame me not for what I forgot and be not hard upon me for what I did. (Khadir gave him another chance.) So they went on until they reached a place where boys were playing. He went to one of them and caught hold'of one (apparently) at random and killed him. Moses (peace be upon him) felt agitated and said: You have killed an innocent person not guilty of slaying another. You have done something aboininable. 
Thereupon Allah's Messenger (ﷺ) said: May Allah have mercy upon us and Moses. Had he shown patience he would have seen wonderful things, but fear of blame, with respect to his companion, seized him and he said: If I ask anything after this, keep not company with me. You will then have a valid excuse in my case, and had he (Moses) shown patience he would have seen many wonderful things. He (the narrator) said: Whenever he (the Holy Prophet) made mention of any Prophet, he always said: May there be mercy of Allah upon us and upon my brother so and so. They, however, proceeded on until they came to the inhabitants of a village who were very miserly. They went to the meeting places and asked for hospitality but they refused to show any hospitality to them. They both found in that village a wall which was about to fall. He (Khadir) set it right. Thereupon he (Moses) said: If you so liked. you could get wages for it. Thereupon he said: This is the partince, of ways between me and you, and, taking hold of his cloth, he said: Now I will explain to you the real significance (of all these acts) for which you could not show patience. As for the boat, it belonged to the poor people working on the river and I intended to damage it for there was ahead of them (a king) who seized boats by force. (When he came) to catch hold of it he found it a damaged boat, so he spared it (and later on) it was set right with wood. So far as the boy is concerned, he has been, by very nature, an unbeliever, whereas his parents loved him very much. Had he grown up he would have involved them in wrongdoing and unbelief, so we wished that their Lord should give them in its place one better in purity and close to mercy. And as for the wall it belonged to two orphan boys in the city and there was beneath it a (treasure) belongin to them,... up to the last verse.
حَدَّثَنَا أُبَىُّ بْنُ كَعْبٍ، قَالَ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏"‏ إِنَّهُ
 بَيْنَمَا مُوسَى عَلَيْهِ السَّلاَمُ فِي قَوْمِهِ يُذَكِّرُهُمْ بِأَيَّامِ اللَّهِ وَأَيَّامُ اللَّهِ نَعْمَاؤُهُ وَبَلاَؤُهُ إِذْ قَالَ
 مَا أَعْلَمُ فِي الأَرْضِ رَجُلاً خَيْرًا أَوْ أَعْلَمَ مِنِّي ‏.‏ قَالَ فَأَوْحَى اللَّهُ إِلَيْهِ إِنِّي أَعْلَمُ بِالْخَيْرِ
 مِنْهُ أَوْ عِنْدَ مَنْ هُوَ إِنَّ فِي الأَرْضِ رَجُلاً هُوَ أَعْلَمُ مِنْكَ ‏.‏ قَالَ يَا رَبِّ فَدُلَّنِي عَلَيْهِ ‏.‏ قَالَ
 فَقِيلَ لَهُ تَزَوَّدْ حُوتًا مَالِحًا فَإِنَّهُ حَيْثُ تَفْقِدُ الْحُوتَ ‏.‏ قَالَ فَانْطَلَقَ هُوَ وَفَتَاهُ حَتَّى انْتَهَيَا
 إِلَى الصَّخْرَةِ فَعُمِّيَ عَلَيْهِ فَانْطَلَقَ وَتَرَكَ فَتَاهُ فَاضْطَرَبَ الْحُوتُ فِي الْمَاءِ فَجَعَلَ لاَ يَلْتَئِمُ
 عَلَيْهِ صَارَ مِثْلَ الْكُوَّةِ قَالَ فَقَالَ فَتَاهُ أَلاَ أَلْحَقُ نَبِيَّ اللَّهِ فَأُخْبِرَهُ قَالَ فَنُسِّيَ ‏.‏ فَلَمَّا تَجَاوَزَا
 قَالَ لِفَتَاهُ آتِنَا غَدَاءَنَا لَقَدْ لَقِينَا مِنْ سَفَرِنَا هَذَا نَصَبًا ‏.‏ قَالَ وَلَمْ يُصِبْهُمْ نَصَبٌ حَتَّى تَجَاوَزَا
 ‏.‏ قَالَ فَتَذَكَّرَ قَالَ أَرَأَيْتَ إِذْ أَوَيْنَا إِلَى الصَّخْرَةِ فَإِنِّي نَسِيتُ الْحُوتَ وَمَا أَنْسَانِيهُ إِلاَّ الشَّيْطَانُ
 أَنْ أَذْكُرَهُ وَاتَّخَذَ سَبِيلَهُ فِي الْبَحْرِ عَجَبًا ‏.‏ قَالَ ذَلِكَ مَا كُنَّا نَبْغِي ‏.‏ فَارْتَدَّا عَلَى آثَارِهِمَا
 قَصَصًا فَأَرَاهُ مَكَانَ الْحُوتِ قَالَ هَا هُنَا وُصِفَ لِي ‏.‏ قَالَ فَذَهَبَ يَلْتَمِسُ فَإِذَا هُوَ بِالْخَضِرِ
 مُسَجًّى ثَوْبًا مُسْتَلْقِيًا عَلَى الْقَفَا أَوْ قَالَ عَلَى حَلاَوَةِ الْقَفَا قَالَ السَّلاَمُ عَلَيْكُمْ ‏.‏ فَكَشَفَ
 الثَّوْبَ عَنْ وَجْهِهِ قَالَ وَعَلَيْكُمُ السَّلاَمُ مَنْ أَنْتَ قَالَ أَنَا مُوسَى ‏.‏ قَالَ وَمَنْ مُوسَى قَالَ
 مُوسَى بَنِي إِسْرَائِيلَ ‏.‏ قَالَ مَجِيءٌ مَا جَاءَ بِكَ قَالَ جِئْتُ لِتُعَلِّمَنِي مِمَّا عُلِّمْتَ رُشْدًا ‏.‏ قَالَ
 إِنَّكَ لَنْ تَسْتَطِيعَ مَعِيَ صَبْرًا وَكَيْفَ تَصْبِرُ عَلَى مَا لَمْ تُحِطْ بِهِ خُبْرًا ‏.‏ شَىْءٌ أُمِرْتُ بِهِ أَنْ
 أَفْعَلَهُ إِذَا رَأَيْتَهُ لَمْ تَصْبِرْ ‏.‏ قَالَ سَتَجِدُنِي إِنْ شَاءَ اللَّهُ صَابِرًا وَلاَ أَعْصِي لَكَ أَمْرًا ‏.‏ قَالَ
 فَإِنِ اتَّبَعْتَنِي فَلاَ تَسْأَلْنِي عَنْ شَىْءٍ حَتَّى أُحْدِثَ لَكَ مِنْهُ ذِكْرًا ‏.‏ فَانْطَلَقَا حَتَّى إِذَا رَكِبَا
 فِي السَّفِينَةِ خَرَقَهَا ‏.‏ قَالَ انْتَحَى عَلَيْهَا ‏.‏ قَالَ لَهُ مُوسَى عَلَيْهِ السَّلاَمُ أَخَرَقْتَهَا لِتُغْرِقَ
 أَهْلَهَا لَقَدْ جِئْتَ شَيْئًا إِمْرًا ‏.‏ قَالَ أَلَمْ أَقُلْ إِنَّكَ لَنْ تَسْتَطِيعَ مَعِيَ صَبْرًا قَالَ لاَ تُؤَاخِذْنِي
 بِمَا نَسِيتُ وَلاَ تُرْهِقْنِي مِنْ أَمْرِي عُسْرًا ‏.‏ فَانْطَلَقَا حَتَّى إِذَا لَقِيَا غِلْمَانًا يَلْعَبُونَ ‏.‏ قَالَ
 فَانْطَلَقَ إِلَى أَحَدِهِمْ بَادِيَ الرَّأْىِ فَقَتَلَهُ فَذُعِرَ عِنْدَهَا مُوسَى عَلَيْهِ السَّلاَمُ ذَعْرَةً مُنْكَرَةً ‏.‏
 قَالَ أَقَتَلْتَ نَفْسًا زَاكِيَةً بِغَيْرِ نَفْسٍ لَقَدْ جِئْتَ شَيْئًا نُكْرًا ‏.‏ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه
 وسلم عِنْدَ هَذَا الْمَكَانِ ‏"‏ رَحْمَةُ اللَّهِ عَلَيْنَا وَعَلَى مُوسَى لَوْلاَ أَنَّهُ عَجَّلَ لَرَأَى الْعَجَبَ وَلَكِنَّهُ
 أَخَذَتْهُ مِنْ صَاحِبِهِ ذَمَامَةٌ ‏.‏ قَالَ إِنْ سَأَلْتُكَ عَنْ شَىْءٍ بَعْدَهَا فَلاَ تُصَاحِبْنِي قَدْ بَلَغْتَ مِنْ
 لَدُنِّي عُذْرًا ‏.‏ وَلَوْ صَبَرَ لَرَأَى الْعَجَبَ - قَالَ وَكَانَ إِذَا ذَكَرَ أَحَدًا مِنَ الأَنْبِيَاءِ بَدَأَ بِنَفْسِهِ
 ‏"‏ رَحْمَةُ اللَّهِ عَلَيْنَا وَعَلَى أَخِي كَذَا رَحْمَةُ اللَّهِ عَلَيْنَا - ‏"‏ فَانْطَلَقَا حَتَّى إِذَا أَتَيَا أَهْلَ قَرْيَةٍ
 لِئَامًا فَطَافَا فِي الْمَجَالِسِ فَاسْتَطْعَمَا أَهْلَهَا فَأَبَوْا أَنْ يُضَيِّفُوهُمَا فَوَجَدَا فِيهَا جِدَارًا
 يُرِيدُ أَنْ يَنْقَضَّ فَأَقَامَهُ ‏.‏ قَالَ لَوْ شِئْتَ لاَتَّخَذْتَ عَلَيْهِ أَجْرًا ‏.‏ قَالَ هَذَا فِرَاقُ بَيْنِي وَبَيْنِكَ
 وَأَخَذَ بِثَوْبِهِ ‏.‏ قَالَ سَأُنَبِّئُكَ بِتَأْوِيلِ مَا لَمْ تَسْتَطِعْ عَلَيْهِ صَبْرًا أَمَّا السَّفِينَةُ فَكَانَتْ لِمَسَاكِينَ
 يَعْمَلُونَ فِي الْبَحْرِ إِلَى آخِرِ الآيَةِ ‏.‏ فَإِذَا جَاءَ الَّذِي يُسَخِّرُهَا وَجَدَهَا مُنْخَرِقَةً فَتَجَاوَزَهَا
 فَأَصْلَحُوهَا بِخَشَبَةٍ وَأَمَّا الْغُلاَمُ فَطُبِعَ يَوْمَ طُبِعَ كَافِرًا وَكَانَ أَبَوَاهُ قَدْ عَطَفَا عَلَيْهِ فَلَوْ
 أَنَّهُ أَدْرَكَ أَرْهَقَهُمَا طُغْيَانًا وَكُفْرًا فَأَرَدْنَا أَنْ يُبَدِّلَهُمَا رَبُّهُمَا خَيْرًا مِنْهُ زَكَاةً وَأَقْرَبَ رُحْمًا
 ‏.‏ وَأَمَّا الْجِدَارُ فَكَانَ لِغُلاَمَيْنِ يَتِيمَيْنِ فِي الْمَدِينَةِ وَكَانَ تَحْتَهُ ‏"‏ ‏.‏ إِلَى آخِرِ الآيَةِ ‏.‏