The chemical reactions and pathways involving terpenes, any of a large group of hydrocarbons that are made up of isoprene (C5H8) units which may be cyclic, acyclic or multicyclic, saturated or unsaturated, and may contain various functional groups.