Answered by Sayyidi Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
How do we avoid backbiting (ghibah)?
We do this by bringing to mind the ugliness and danger of
backbiting. We should also reflect on the punishment for it in the next life. In
the Quran, Allah likens the person who backbites to someone who eats the flesh
of his dead brother. We should see backbiting as a lightning bolt which
destroys our good deeds. We should accustom ourselves to only mentioning a
person’s good deeds and qualities if there is a benefit in doing so.
If we are tempted to backbite someone due to a perceived fault, we should do two things instead: pray for them and give them sincere advice either directly or indirectly.
Instead of allowing yourself to backbite, you must hold your tongue and use it to remember Allah. Instead of talking about worldly things, use wisdom in choosing a topic of conversation which is beneficial, such as stories of the Prophet, the Companions, the pious or the next life. In this way you will be acting upon the hadith: “Whoever believes in Allah and the Last Day should say what it is good or remain silent.”