Sunan Ibn Majah 252
The Book of the Sunnah
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا يُونُسُ بْنُ مُحَمَّدٍ، وَسُرَيْجُ بْنُ النُّعْمَانِ، قَالاَ حَدَّثَنَا فُلَيْحُ بْنُ سُلَيْمَانَ، عَنْ عَبْدِ اللَّهِ بْنِ عَبْدِ الرَّحْمَنِ بْنِ مَعْمَرٍ أَبِي طُوَالَةَ، عَنْ سَعِيدِ بْنِ يَسَارٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ " مَنْ تَعَلَّمَ عِلْمًا مِمَّا يُبْتَغَى بِهِ وَجْهُ اللَّهِ لاَ يَتَعَلَّمُهُ إِلاَّ لِيُصِيبَ بِهِ عَرَضًا مِنَ الدُّنْيَا لَمْ يَجِدْ عَرْفَ الْجَنَّةِ يَوْمَ الْقِيَامَةِ " . يَعْنِي رِيحَهَا . قَالَ أَبُو الْحَسَنِ أَنْبَأَنَا أَبُو حَاتِمٍ، حَدَّثَنَا سَعِيدُ بْنُ مَنْصُورٍ، حَدَّثَنَا فُلَيْحُ بْنُ سُلَيْمَانَ، فَذَكَرَ نَحْوَهُ .
It was narrated that Abu Hurairah said:"The Messenger of Allah said: 'Whoever acquires knowledge by which the pleasure of Allah is sought, but he only acquires it for the purpose of worldly gain, will not smell the fragrance of Paradise on the Day of Resurrection.'" (Hasan) Another chain with similar wording
Grading: Al-Albani: Sahih · Muhammad Fouad Abd al-Baqi: Sahih · Shuaib Al Arnaut: Hasan · Zubair Ali Zai: Isnaad Hasan
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.