This lecture summarises how our understanding of many aspects of the Sun has been revolutionised over the past few years by new observations and models. Much of the dynamic behaviour of the Sun is driven by the magnetic field since, in the outer atmosphere, it represents the largest source of energy by far. The interior of the Sun possesses a strong shear layer at the base of the convection zone, where sunspot magnetic fields are generated. A small-scale dynamo may also be operating near the surface of the Sun, generating magnetic fields that thread the lowest layer of the solar atmosphere, the turbulent photosphere. Above the photosphere lies the highly dynamic fine-scale chromosphere, and beyond that is the rare corona at high temperature...