Once a man came to Amir ul-Mu’minīn (a.s.) and exclaimed loudly: “Astagfirullah”. The Hazrat said,
“May your mother mourn you! Do you understand what Istighfar is?”
For the word ‘Istighfar’ to be meaningful a person must first undergo a mental reformation. Which means that he is sorry and shameful about the earlier misdeeds, and has resolved to give up sin forever. He must pay the dues (rights) of others so that when he dies he meets his Lord Almighty without others’ having any claim on him. He must perform all the duties obligatory on him without fail. If his flesh and blood were made up of unlawful earning he should be fearful and worry about the punishments of Hell to such an extent that his body becomes extremely thin and lean and only thereafter it should be rebuilt on lawful food. He must worship Allah (S.w.T.) so much that his body experiences hardships and atones for the unlawful pleasure enjoyed by it.
When these conditions are fulfilled, then you should utter Astaghfirullah.