Know that there is no good in knowledge that is not beneficial, and knowledge that is not worthy of acquisition is not beneficial
"و اعلم انّه لا خير في علم لاينفع ولا ينفع بعلم لا يحق تعلمه"
As we know, the Islamic commandments and its allowable and prohibited actions all depend on the profit and loss which these concepts have for the individual and the community as a whole. Thus, the acquisition of any knowledge, too, is not an exception to this general rule. The knowledge that deserves to be studied is that which is profitable. If it does not bear any profit, learning it is absurd, and if it hurts, it should be abandoned.
On the basis of this concept, in Islam the acquisition of some sciences is compulsory and worthwhile, such as jurisprudence, Hadith, ethics, and Islamic knowledge. Some other sciences are forbidden. Such as witchcraft, or any science which in one way or another hurts the welfare of the community. For this reason, Imam ‘Ali (as) in this part of his discourse says, "If knowledge (of something) is not profitable, it will not contain any good," The Prophet (S) has said in this regard, "O God! I resort to you for not learning any science which is not profitable".1
Sheikh Ansari, at the beginning of his book called "Makasib" records the famous tradition in “Tuhaf al-‘Uqul” from Imam Sadiq (as) who talks of lawful and unlawful knowledge as the following:
“Any kind of skill that the believers could learn or teach are lawful and practical such as writing, accounting, trade, goldsmith's trade, saddle-making, building, weaving, laundering, tailoring, face-sculpture, except the sculpture of the clergy, and making the tools which people need and take benefit out of and their life is dependent on them. God has forbidden those industries the results of which are unlawful, such as making musical instruments (Tar and pipes), making chess, making of the cross and idol making, brewing alcoholic beverages, which lead to corruption. The teaching and learning of these affairs are forbidden”.2
"اَي بُنَي اِنِّي لَمَّا رَأَيتُني قد بَلَغتُ سِنّاً، وَرَأيتُني اَزدَادُ وَهْناً، بَادَرتُ بِوَصِيتِي اِلَيكَ، وَاَورَدتُ خِصَالاً مِنهَا قَبلَ اَن يَعجَل بِي اَجَلِي دُونَ اَن اُفضِي اِلَيكَ بِمَا فِي نَفْسِي اَو اَن اَنقُصَ في رَأيي كَمَا نَقَصْتُ فِي جِسْمِي اَو يَسبِقَنِي اِلَيكَ بَعضُ غَلَبَاتِ الهَوى اَو فِتَنِ الدُّنيا فَتَكُونَ كَالصَعْبِ النُّفُورِ، وَاِنَّما قَلبُ الحَدَثِ كَالارْضِ الخَالِيَةِ: مَا اُلقِيَ فِيهَا مِن شَئٍ قَبِلَتهُ فَبَادَرتُكَ بِالاَدَبِ قَبلَ اَن يَقسُوَ قَلبُكَ وَيَشتَغِلَ لُبُّكَ، لِتَستَقْبِلَ بِجَدِّ رَأيكَ مِنَ الاَمرِ مَا قَد كَفَاكَ اَهلُ التَجَارِبِ بُغيَتَهُ وَتَجْرِبَتَه، فَتَكُونَ قَدْ كُفِيْتَ مَؤُنَةَ الطَّلَبِ وَعُوفِيتَ مِن عِلاجِ التَجْرِبَةِ فَاتَاكَ مِن ذَلِكَ مَا قَد كُنّا نَأتِيهِ وَاستَبَانَ لَكَ مَا رُبَما اَظْلَمَ عَلَينَا مِنْهُ"
“My son! When I saw that I had reached old age, and I saw myself increase in weakness, I hastened with my will to you. I set out in it some useful points lest death overtake me without my having acquainted you with my thoughts or (lest) my mind weaken just as my body has weakened or some mastery of desire and the temptations of the world get to you before me, so that you become like a refractory camel.
The heart of a young man is like empty land which accepts anything that is strewn on it. Thus I hastened to (instruct) you in good discipline before your heart hardens and your mind is occupied, so that you may face with sound judgment the endeavours and experiences of the people of experience which are sufficient for you. Thus you will be spared the trouble of seeking and relieved of the cultivation of experience; for you receive our experiences and what may have been unclear for us will become clear to you”.
1. Ibn Maytham's Commentary of Nahj al-Balaghah, vol.5, p.12.
2. Tuhaf al-‘Uqul, pp.335-336.