Since the beginning of the twentieth century, confinement of atoms, molecules and plasma inside impenetrable sharp (hard) and smooth (soft) cavities has been studied with utmost interest. Physically, such situations introduce the trapping of a quantum system under high pressure. The internal pressure (Pn,ℓ) of the system under multi-megabar external pressure has not yet been explored. Also, there is a lack of Hellmann–Feynman theorem (HFT) in such a scenario, which is essential to derive a concrete analytical expression of Pn,ℓunder stressed condition. Here using a scaling concept we provide a general HFT in terms of expectation values of total energy, potential and kinetic energy of a given confined system. A change in boundary condition (from smooth to sharp and vice versa) does not affect this. Applying this proposed HFT, a closed-form expression of Pn,ℓ and d2E/dR2 has been obtained for confined and shell-confined quantum systems. Based on this Pn,ℓ, several virial-like equations are also modeled. This HFT and Pn,ℓ are demonstrated for one- and many-electron atoms, plasmas and molecules using both analytical and numerical methods. Their applicability in several other confined systems is discussed from simple arguments.