Using data from direct numerical simulations, linear models of the compressible flow past a rectangular cavity are found. The emphasis is on forming simple models which capture the input–output behaviour of the system, and which are useful for feedback controller design. Two different approaches for finding a linear model are investigated. The first involves using input–output data of the linearized cavity flow to form a balanced, reduced-order model directly. The second approach is conceptual, and involves modelling each element of the flow physics separately using simple analytical expressions, the parameters of which are chosen based on simulation data at salient points in the cavity’s computational domain. Both models are validated: first in the time domain by comparing their impulse responses to that of the full system in direct numerical simulations; and second in the frequency domain by comparing their frequency responses. Finally, the validity of both linear models is shown most clearly by using them for feedback controller design, and then applying each controller in direct numerical simulations. Both controllers completely eliminate oscillations, and demonstrate the advantages of model-based feedback controllers, even when the models upon which they are based are very simple.