There’s a famous hadith in Bayhaqi that says:
الحديث الذي ورد عن النبي صلى الله عليه وسلم أنه قال لأصحابه لما رجعوا من الغزو : ( رجعنا من الجهاد الأصغر ، إلى الجهاد الأكبر ) ، قالوا : وهل هناك جهاد أعظم من جهاد الكفار ؟ قال : ( نعم . جهاد النفس ) .
It was narrated that the Prophet (peace and blessings of Allah be upon him), said to his companions when they returned from a military campaign, “We have come back from the lesser jihad to the greater jihad.” They said, “Is there any greater jihad than jihad against the kuffar?” he said, “Yes, jihad al-nafs (jihad against the self).”
This hadith has weakness in its chain, but its meaning is sound. There’s other hadith which confirm its meaning, for example:
الْمُجَاهِدُ مَنْ جَاهَدَ نَفْسَهُ
And I heard the Messenger of Allah (ﷺ) saying: “The Mujahid is one who strives against his own soul.”Tirmidhi 1621
And another hadith from the farewell pilgrimage:
روى الإمام أحمد (23958) ، وابن حبان (4862) ، والطبراني في “المعجم الكبير” (796) ، والحاكم (24) ، وابن المبارك في “الزهد” (826) ، والنسائي في “السنن الكبرى” (11794) ، والبيهقي في “الشعب” (10611) عن فَضَالَة بْن عُبَيْدٍ ، قَالَ: قَالَ رَسُولُ اللهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ فِي حَجَّةِ الْوَدَاعِ: ( أَلَا أُخْبِرُكُمْ بِالْمُؤْمِنِ؟ مَنْ أَمِنَهُ النَّاسُ عَلَى أَمْوَالِهِمْ وَأَنْفُسِهِمْ ، وَالْمُسْلِمُ مَنْ سَلِمَ النَّاسُ مِنْ لِسَانِهِ وَيَدِهِ ، وَالْمُجَاهِدُ مَنْ جَاهَدَ نَفْسَهُ فِي طَاعَةِ اللهِ ، وَالْمُهَاجِرُ مَنْ هَجَرَ الْخَطَايَا وَالذَّنُوبَ ) .
Narrated in Ahmad, ibn Hibban, Tabarani in Mujam al-Kabir, and Hakim, and ibn Mubarak in “Az-Zuhd,” and Nisa’i in Sunan al-Kubra, and Bayhaqi from Fadalah ibn Ubayd who said:
The prophet (sallah Allahu alayhi wa sallam) said in his farewell pilgrimage: Shall I not inform you of the believer? He who the people are safe from in their wealth and persons, and the Muslim is who the people are safe from his tongue and his hand, and the mujahid is who strives against himself in obedience of Allah, and the emigrant is who emigrates from transgression and sin.Source
Indeed, the greatest jihad is getting ourselves right and getting our hearts right, and it is perhaps a pre-requisite to a sincere, correctly executed lesser jihad, like that of sheikh Abdul Qader al-Jaziri or Omar al-Mukhtar, may Allah have mercy on them.