Would you say these thoughts are intrusive - totally involuntary - or is there something in your life/surroundings that brings them on?
There are definitely ways to put a damper on these types of unwanted thoughts either way, but it's hard to put a stop to them completely, especially if they're being brought on randomly. When it comes to unwanted thoughts, pushing them away tends to do more harm than help, because the upsetting thought needs to be dealt with in a healthy way. This
article from Medical News Today talks about several ways to do this, including:
- identifying the thoughts as intrusive (you've already named the fact that you don't like these thoughts)
- clarifying that they are involuntary and irrelevant to daily life (you've already named their irrelevance to daily life)
- accepting their presence instead of pushing them away (this seems counterintuitive, but accepting these thoughts can mean learning to cope with them so that they don't overpower you)
- continuing normal behavior (try not to stay inside your head. Get back into the normal swing of things)
- understanding that the thoughts may return (and that you can be prepared for them)
- practicing meditation or mindfulness (practice replacing the thoughts, or talking yourself through them)
I would add to these that it might help to find a preferable thought to replace upsetting thoughts with, like erasing messages from a whiteboard and replacing it with something else. The "message" may appear in your mind again, but you can actively acknowledge its presence and mentally going somewhere else. Maybe you have a favorite album you like to listen to that you can hum the lyrics to, or a favorite book you like to read?