The dynamics of charged particles in general linear focusing lattices with quadrupole, skew-quadrupole, dipole, and solenoidal components, as well as torsion of the fiducial orbit and variation of beam energy is parametrized using a generalized Courant-Snyder (CS) theory, which extends the original CS theory for one degree of freedom to higher dimensions. The envelope function is generalized into an envelope matrix, and the phase advance is generalized into a 4D symplectic rotation, or a $U(2)$ element. The 1D envelope equation, also known as the Ermakov-Milne-Pinney equation in quantum mechanics, is generalized to an envelope matrix equation in higher dimensions. Other components of the original CS theory, such as the transfer matrix, Twiss functions, and CS invariant (also known as the Lewis invariant) all have their counterparts, with remarkably similar expressions, in the generalized theory. The gauge group structure of the generalized theory is analyzed. By fixing the gauge freedom with a desired symmetry, the generalized CS parametrization assumes the form of the modified Iwasawa decomposition, whose importance in phase space optics and phase space quantum mechanics has been recently realized. This gauge fixing also symmetrizes the generalized envelope equation and expresses the theory using only the generalized Twiss function $\ensuremath{\beta}$. The generalized phase advance completely determines the spectral and structural stability properties of a general focusing lattice. For structural stability, the generalized CS theory enables application of the Krein-Moser theory to greatly simplify the stability analysis. The generalized CS theory provides an effective tool to study coupled dynamics and to discover more optimized lattice designs in the larger parameter space of general focusing lattices.