© 2022, The Author(s).Measurements of jet substructure describing the composition of quark- and gluon-initiated jets are presented. Proton-proton (pp) collision data at s = 13 TeV collected with the CMS detector are used, corresponding to an integrated luminosity of 35.9 fb−1. Generalized angularities are measured that characterize the jet substructure and distinguish quark- and gluon-initiated jets. These observables are sensitive to the distributions of transverse momenta and angular distances within a jet. The analysis is performed using a data sample of dijet events enriched in gluon-initiated jets, and, for the first time, a Z+jet event sample enriched in quark-initiated jets. The observables are measured in bins of jet transverse momentum, and as a function of the jet radius parameter. Each measurement is repeated applying a “soft drop” grooming procedure that removes soft and large angle radiation from the jet. Using these measurements, the ability of various models to describe jet substructure is assessed, showing a clear need for improvements in Monte Carlo generators. [Figure not available: see fulltext.].