How can we keep from committing sin? We can keep from committing sin by praying and by receiving the sacraments; by remembering that God is always with us; by recalling that our bodies are temples of the Holy Ghost; by keeping occupied with work or play; by promptly resisting the sources of sin within us; by avoiding the near occasions of sin.
And if thy right hand scandalize thee, cut it off and cast it from thee. For it is expedient for thee that one of thy members perish rather than that thy whole body go into hell. (Mark 9:42)
What are the chief sources of actual sin? The chief sources of actual sin are: pride, covetousness, lust, anger, gluttony, envy, and sloth, and these are commonly called capital sins.
Why are these called capital sins? They are called capital sins, not because they, in themselves, are the greatest sins, but because they are the chief reasons why we commit sin.
Further reading: CCC 1865-1869