“Shaykh Muqbil Bin Hadi Al-Wadi’i was asked:
What is the ruling on the one who curses the Jinn?
If he means by it the Shaayateen (the devils), then what is most deserving is that he should say Bismillah (in the Name of Allah) and that he remembers Allah for that is more deserving than the one who curses them. Otherwise it is allowed since the Prophet (may the peace and blessings of Allah be upon him) said,
إذا عثر أحدكم فليقل: بسم الله ولا يقل: تعس الشيطان، فإنه إذا قال : تعس الشيطان تعاظم ، ويقول : صرعت بني آدم بقوتي ، ولكن إذا قال : بسم الله تصاغر
‘If anyone of you trips then let him say Bismillah (in the name of Allah) and let him not say curse the Shaytaan. If he says curse the Shaytaan, the Shaytaan grows and he (the Shaytaan) says I have overcome the son of Adam with my strength. However if he says Bismillah (in the name of Allah) he (the Shaytaan) gets smaller.’
End quote. [Saheeh Sunan Abu Dawood 4982]
So the remembrance (of Allah), doing (good) deeds, reading the Quran and being steadfast is more deserving.