There are many reasons why hair can get an unpleasant smell: being sprayed by a skunk, sweat, cigarette smoke, or recent chemicals in the hair (such as perms or hair dyes) can add an odor. However, if you feel that your foul-smelling hair is something bigger than just sweaty hair, there may be a problem. Bacteria can build up on your scalp and in your hair follicles. This bacteria is what can cause your hair--more specifically, your head--to smell bad. Luckily, there are a few things that you can try to get rid of the smell.
Wash your pillowcases and body/hair towels every other day. The smell in your hair might be caused by dirt, oils and bacterias held in the pillow cases and towels. Wash these items with regular laundry detergent, and always wash white cases and towels in bleach. For colors, add one cup of white vinegar and 1/4 cup of baking soda to the wash along with the detergent. The vinegar/baking soda mixture will help to safely any kill bacteria. Also, remember to wash your hats often as well. Baseball caps and knit hats can be washed in the washing machine along with the vinegar/baking soda mixture.
Wash your hair with medicated shampoo. You can find both antimicrobial and antibacterial shampoos and conditioners at any beauty supply store. Wash your hair as normal using the medicated shampoo/conditioner. The medicated treatments will help to kill bacteria and fungus and reduce hair oils to rid your hair of odor.
Stop using too many hair products. Hair products like hairspray, gels, pomade and hair oils can increase the oil in your hair. The increase in oil will increase the odor.
See a doctor. If you've stopped using unnecessary hair products; you have washed your pillow cases, hair towels and hats; and you've been using medicated shampoos and conditioners, but your hair still smells bad, there may be a larger problem. See a dermatologist as quickly as possible to get a professional diagnosis.