How would I know when to resist the devil?

For example, when some sudden thoughts come to your mind, realise that it may sometimes be the thoughts or suggestions implanted into the mind by devil. Not all thoughts in our mind are the ones which originates from us.

To resist,

  1. When some sudden unclean thought comes to mind, recognise the probability that the devil is trying to distract you.
  2. After recognising this, refuse to think about that unclean thought. Purposefully distract mind to something positive or profitable.