Saying curse words, if I am not mistaken, is in the category of nivul peh.
For someone that is used to using curse words, what steps can he take to avoid this transgression?
Just a suggestion, but one which worked for me -- when I got married I thought to myself, "would it be appropriate for a 1 year old to have his or her first words be curses?" Children imprint on the language they hear around them. So I decided that I was going to keep myself from saying words for the sake of my as of yet unborn children. If I got into the habit of NOT saying those words now, then when the kids came, I would be less likely to slip up and then have them repeat something I knew was inappropriate.
In the same way, I knew that in the classroom (I am a classroom teacher) I had to watch my mouth. But if words were habitual, then I would have more trouble controlling them, so I practiced being more conscious of my word choice at ALL times, even when not in the class, so by the time I got into the class, speaking properly (vis-a-vis grammar and propriety) would be my norm.
While I do not in anyway meant to minimize the difficulty of removing profanity from one's vocabulary (or the effort of those who have been successful), it may be helpful to recall that if you have learned to use profanity you have probably already mastered not using it settings where such language is frowned upon.
From my experience I would suggest the following:
Consider the circumstances when you resort to such language and develop ready to go alternatives. Although not as regularly as when I first eliminated profanity from my vocabulary, I will still exclaim "unacceptable" when I bang my shin or so forth.
Avoid using profanity in you head/self-talk. It is easy to focus on the act of using profanity but I don't think anyone will find it counter-intuitive if I suggest that indulging in such language in one's mind will make it much more difficult to keep from using it in speech.
Aside from any halachic obligation, avoid listening to music with profanity. We tend to "sing along" with music, even if we do not articulate it verbally. This is especially true when you still use profanity habitually. Of course it is best to avoid any exposure to profanity, especially elective, but I would suggest a special emphasis on music in this regard.
I would start by picking a window of time, maybe 30 min, maybe 15, where you can stay conscious and in control of what I am saying. "From 6 to 6:30 pm, I will not speak nivul peh."
After a week, stretch that window. And then extend it again the third week. At some point, instead of taking on more time, move it to a more sensitive part of the day/week, like when you tend to see friends who talk similarly and it's harder to stay in control.
Two more suggestions. although the first one is more effective these may help too:
Keep a cheshbon hanefesh, a journal where you record the days successes and failures. Could be just a list of checks and minuses, or actual descriptive text. Whatever forces you to review the day. By being conscious at the end of the day about what the triggers are, it's easier to become more aware in the moment when the temptation is there.
Third, write on a slip of paper, "עַל-כֵּן עַל-בַּחוּרָיו לֹא-יִשְׂמַח ה', וְאֶת-יְתֹמָיו וְאֶת-אַלְמְנוֹתָיו לֹא יְרַחֵם--כִּי כֻלּוֹ חָנֵף וּמֵרַע, וְכָל-פֶּה דֹּבֵר נְבָלָה; בְּכָל-זֹאת לֹא-שָׁב אַפּוֹ, וְעוֹד יָדוֹ נְטוּיָה. -- Therefore, Hashem will have no joy in [this nation's] young men, nor will He have compassion on its orphans and His widows; for every one is ungodly and an evil-doer, and every mouth speaks disgustingness; in all this His Anger is not turned away, and His hand is still stretched out."
Read it in the morning, then put it in your pocket. Whenever your hand touches the piece of paper, it will be another reminder of what you're working on.
Have a great and successful Elul. Kol hakavod!
All the techniques above are great techniques to help kick a habit. I'm just going to toss in my $.02, as it's different than what others have said and can also hopefully be helpful. This was one of the techniques I heard from my Rebbi, when he would speak about kicking bad habits.
Another technique I've heard (used in many other instances as well) would be to spread the word and let people know you don't curse anymore. This causes others to know you've made a change, and creates a certain level of 'fear' in yourself, as you don't want to be viewed as a 'hypocrite' by your friends.
For example, if you're talking with friends, you can start the conversation by saying 'By the way, I'm going cold-turkey on swearing. I'm not swearing anymore.' This essentially forces you to live up to the standard you are setting up for yourself, or risk embarrassment.
I have had several computer science professors in college who are geniuses (one of whom has been known to frequent these boards. Hi Professor!), and are also great Talmidei Chachamim and all around good people. One of them (worked for the longest time in the'corporate world') would let people know upfront that he 'was a Rabbi and didn't partake of certain ways of speaking and acting'. As he also lived by that motto himself, the people around him respected that and made sure that they also acted more appropriately around him.
Another professor shared a story where he was reading over a writing from a book to a group of peers, and he didn't realize that the variable names that the author used, to keep things 'fun and exciting', also had an inappropriate/innuendo meaning to it. As soon as my professor read it, one of the listeners gasped and said "Rabbi, how could you say that!"
Even in my own limited (so far) experience in the corporate world, I've had a coworker shockingly ask "where my hat was", when I was sitting at a a different angle than him and my Kippah had slid a bit backwards on my head.
But the point of these past 3 paragraphs, besides hopefully being fun and interesting stories, is to bring out the point that if you want to kick a habit, you can use peer pressure and social norms to aid you in the battle. If you set up an environment where you're expected to act in a certain way, your environment can then help you keep on track to stay there.
I'll end off with another story I heard about using this technique about a certain Rabbi (don't remember who off the top of my head, I recall that he was a Mashgiach in a Yeshiva, want to say the Mir but don't quote me on that), as this is a Judaism site after all. This was the era when smoking just started becoming known to be unhealthy, and many of the 'older generation' were already hooked on cigarettes. One morning, the Rabbi stood at the doorway and every time a student walked in, he said "Good morning. I quit smoking today." That day he kicked the habit, as he said "How could I smoke now after everyone knows that I quit, it will be too embarrassing if anyone sees me".
Words spoken instinctively are produced through muscle memory, rather than a conscious decision involving reflection. Something slips from your hand, you say, "xxxxxxx!".
All muscle memories can be retrained, but your desire to exclaim will remain, so pick a replacement word for each of those you wish to purge, and then practice it, like a sportsperson or performer polishing their technique. Hold a small cushion, let it spill from your hand, say the new word. Repeat twenty times.
This answer is based merely on personal experience, but successful personal experience. I noticed that a lot of seemingly acceptable exclamations are merely euphemisms for or modifications of unacceptable ones, so I just invented my own meaningless nonsense words.
Long term habits can be extremely difficult to reverse. As suggested above, the best idea is to identify the environments that cause you to speak profanity and avoid such situations as best as possible.
Most of the time, people who speak profanity do so because they are frustrated or angry at someone. So, if you can, avoid the people and situations that frustrate you. If you can't, you need to discipline your overall attitude when dealing with these people. Some people get pleasure in frustrating you. So, ask yourself a serious question - why do you let them do that to you? Aren't you better than that? Remember, it takes two people to argue. If you drop out, the argument isn't there, and you end up winning and being a better person.
Sometimes people use profanity as sentence "filler". Every second or third word is a four-letter word. This is a tougher habit to dispose. Put on a tape recorder, and say what you usually say with the profanity. Play it back a few times. Do this for a few days. I have no doubt that when you hear yourself, you'll quickly realize how ridiculous you sound. Does this filler really add anything useful to what you want to say? Of course not! Would you want someone else to talk to you like that? Probably not. Well, that otehr person is you.
Now, you're on your way to improving. Speak to yourself, the way you want others to speak to you - nicely, without profanity. Before you know it, you're talking and looking nice and "clean".
Another general rule related to environment. I don't watch much TV. the bit that I watch is usually limited to news programs, and there's almost no profanity there. I rarely go to movies. And, the only concerts I attend are classical concerts where no one is singing. (I don't care much for opera). So, these are all other ways where you can enjoy yourself and still avoid profanity. (I highly recommend listening to Symphonie Fantastique. In a way, Berlioz wanted to say something nasty but used loud music instead of profanity :-)
very simple solution. for 1 week, fine yourself 20 dollars to tzedaka each time bli neder (max.100 dollars/day). you can ask someone to collect from you daily how much you owe. maybe give him a cut for his time. or tell your friends if they catch you swearing you will pay them x dollars.
if you want renew it again 2nd week.
if you follow this program, guarantee you will stop very quickly
I hope you don't mind that I post here despite being agnostic atheist.
What I can recommend in general to change habits is to learn Mindfulness. Learn to reflect on yourself; watch yourself from an outside perspective.
One does not typically be mindfull from one day to the other, but over a longer term, this will help you not only in bending your parlance into the direction you want it, but basically everything.
In the beginning, it is not easy, and you may even feel uncomfortable while recognizing things on yourself that you did not know.
But, that's the programmer in me, what you measure you can optimize (*).
(*): As an example, I stopped perceiving stress when followed by tailgaters on highways once I absorbed some Zen lessons.
(**): A comment indicated that "This is a Jewish board" (which I already happen to know). However, neither meditation nor mindfulness are techniques which are in any way hard-linked to (Zen-)Buddhism. Even atheists or agnostics can make use of their benefits.