Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:18:65

And they found a servant from among Our servants to whom we had given mercy from us and had taught him from Us a ˹certain˺ knowledge.  

So ˹there˺ they found one of Our servants, namely, al-Khidr, to whom We had given mercy from Us — according to one opinion this ˹mercy˺ was prophethood; according to another it was authority, and this ˹latter˺ is the opinion of the majority of scholars — and We had taught him knowledge from Us (‘ilman is the second direct object), in other words, some knowledge of unseen things; al-Bukhārī reports the ˹following˺ hadīth: ‘Moses was delivering a sermon among the Children of Israel and was asked, “Who is the most knowledgeable of people?”, to which he ˹Moses˺ said, “Myself”. God then reproached him for not having attributed ˹his˺ knowledge as ˹coming˺ from Him. God then revealed to him the following: “Truly, there is a servant of Mine at the juncture of the two seas; he is more knowledgeable than you”. Moses then asked, “My Lord, how do I reach him?” He ˹God˺ said, ‘Take a fish with you and place it in a basket and ˹the place˺ where you lose the fish will be ˹the place˺ where he is.” He ˹Moses˺ took a fish and placed it in a basket and departed together with his lad Joshua son of Nun until they reached the rock. ˹There˺ they placed their heads back and fell asleep. The fish began to move about in the basket, until it escaped from it and fell into the sea, and it made its way into the sea in an amazing manner. God then held back the flow of the water ˹preventing it˺ from ˹engulfing˺ the fish, forming a kind of arch over it. When he awoke, his companion ˹Joshua˺ forgot to inform him of ˹what had happened to˺ the fish, and so they journeyed on for the remainder of that day and night until on the morning ˹of the second day˺ Moses said to his lad, ‘Bring us our breakfast’, to where he says, and it made its way into the sea in an amazing manner’. He ˹Bukhārī˺ said, ‘For the fish, it ˹the way into the sea˺ was ˹by˺ ‘burrowing’ (saraban), and for Moses and his lad it ˹this way˺ was ‘amazing’ (‘ajaban) …’ ˹and so on˺ to the end ˹of Bukhārī’s report˺.
القرآن:١٨:٦٥

فَوَجَدَا عَبْدًا مِنْ عِبَادِنَا آتَيْنَاهُ رَحْمَةً مِنْ عِنْدِنَا وَعَلَّمْنَاهُ مِنْ لَدُنَّا عِلْمًا  

(فوجدا عبدا من عبادنا) هو الخضر (آتيناه رحمة من عندنا) نبوة في قول وولاية في آخر وعليه أكثر العلماء (وعلمناه من لدنا) من قبلنا (علما) مفعول ثان أي معلوما من المغيبات، روى البخاري حديث "" إن موسى قام خطيبا في بني إسرائيل فسئل أي الناس أعلم؟ فقال: أنا، فعتب الله عليه إذ لم يرد العلم إليه، فأوحى الله إليه: إن لي عبدا بمجمع البحرين هو أعلم منك قال موسى: يا رب فكيف لي به قال: تأخذ معك حوتا فتجعله في مكتل فحيثما فقد الحوت فهو ثم، فأخذ حوتا فجعله في مكتل ثم انطلق وانطلق معه فتاه يوشع بن نون حتى أتيا الصخرة ووضعا رأسيهما فناما واضطرب الحوت في المكتل فخرج منه فسقط في البحر "" فاتخذ سبيله في البحر سربا "" وأمسك الله عن الحوت جرية الماء فصار عليه مثل الطاق فلما استيقظ نسي صاحبه أن يخبره بالحوت فانطلقا بقية يومهما وليلتهما حتى إذا كانا من الغداة قال موسى لفتاه آتنا غداءنا إلى قوله واتخذ سبيله في البحر عجبا قال وكان للحوت سربا ولموسى ولفتاه عجبا إلخ "".