My daughter does this as well, I think it is largely directed at moms because we tend to be at home as the disciplinarian and are generally the one saying no or who are otherwise frustrating them. Some of the hair pulling I know was accidental, and it has helped to talk with her and show her nice, gentle touches. We will practice when we are having some quiet time sitting on the couch together, and it seems to help to remind her to be gentle when she does it out of anger.
Also, it hasn't totally resolved the problem but has vastly improved it...if she persists after I've told her no, I will put her down, whatever we're doing, tell her that's a no, it hurts mommy and it's not nice and that we only use nice touches, and WALK AWAY. Not quite the same as a time out, but truly they do want our attention, and I think it makes an impact to say with your actions that I'm not going to be here with you if you're going to (hit/bite/scratch, etc.) because that hurts.
Also, you might consider whether you can identify particular issues/that trigger that behavior. Although it could just be that he's tired, often times it has to do with being frustrated because they can't communicate a want/need. If you can identify the trigger, you may be able to teach him a few signs that will assist him in communicating. Consistency is also important, make sure other people who are around aren't giving in to him when he uses that behavior (i.e. if he does it because you tell him it's time to put away toys and take a nap, his behavior shouldn't be encouraged by you or others by permitting him to continue to play longer after hitting and scratching).
I'm also interested to hear what other mom's have found to be helpful!