3D printer: How to home only Z axis using G-Code?

To home only the Z axis on 3D printers running on most firmwares, use G28 with the Z axis specifier

G28 Z