Modern electron linear accelerators are often designed to produce smooth bunch distributions characterized by their macroscopic ensemble-average moments. However, an increasing number of accelerator applications call for finer control over the beam distribution, e.g., by requiring specific shapes for its projection along one coordinate. Ultimately, the control of the beam distribution at the single-particle level could enable new opportunities in accelerator science. This review discusses the recent progress toward controlling electron beam distributions on the "mesoscopic" scale with an emphasis on shaping the beam or introducing complex correlations required for some applications. This review emphasizes experimental and theoretical developments of electron-bunch shaping methods based on bounded external electromagnetic fields or via interactions with the self-generated velocity and radiation fields. 1. Space-charge field with a single bunch 41 2. Space-charge field with a few bunches 43 3. Space-charge field with multiple bunches: space-charge oscillation 44 4. Space-charge field with multiple bunches: longitudinal cascade amplifier 46 5. Space-charge field with multiple bunches: plasma cascade amplifier 47 B. Shaping profiles using coherent synchrotron radiation 47 C. Shaping profiles using wakefields 49 1. Bunch compression 50 2. Bunch train generation 50 3. Single-bunch profile shaping 51 4. Control over the energy distribution 52 5. Control over longitudinal phase space 53 VI. Coupling between degrees of freedom for phase-space tailoring 54 A. Introduction 54 B. Coupling between the two transverse degrees of freedom 54 1. Producing beams with canonical angular momentum 54 2. Decoupling of CAM-dominated beams and transverse emittance partitioning 55 3. Phase-space exchange between the two transverse planes 57 C. Transverse-to-longitudinal phase-space exchangers 59 1. Emittance exchange 59 2. Current profile shaping 60 3. Bunch compression 62 4. Double phase-space exchangers 62 D. Generalized phase-space repartitioning between the three degrees of freedom 65 1. Flat beam transformation combined with emittance exchange 65 2. Coupling between the longitudinal and transverse phase spaces 65