'Ibn 'Abbas narrated that a man cursed the wind in the presence of the Prophet, so he said: "Do not curse the wind, for it is merely doing as ordered , and whoever curses something undeservingly, then the curse returns upon him."
Source: sunnah.com
Other translations
Arabic
حَدَّثَنَا زَيْدُ بْنُ أَخْزَمَ الطَّائِيُّ الْبَصْرِيُّ، حَدَّثَنَا بِشْرُ بْنُ عُمَرَ، حَدَّثَنَا أَبَانُ بْنُ يَزِيدَ، عَنْ قَتَادَةَ، عَنْ أَبِي الْعَالِيَةِ، عَنِ ابْنِ عَبَّاسٍ، أَنْ رَجُلاً، لَعَنَ الرِّيحَ عِنْدَ النَّبِيِّ صلى الله عليه وسلم فَقَالَ " لاَ تَلْعَنِ الرِّيحَ فَإِنَّهَا مَأْمُورَةٌ وَإِنَّهُ مَنْ لَعَنَ شَيْئًا لَيْسَ لَهُ بِأَهْلٍ رَجَعَتِ اللَّعْنَةُ عَلَيْهِ " . قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ غَرِيبٌ لاَ نَعْلَمُ أَحَدًا أَسْنَدَهُ غَيْرَ بِشْرِ بْنِ عُمَرَ .
sunnah.com