Set display to sleep after 15 minutes when on battery power

pmset

  • Configure macOS power management settings, as one might do in System Preferences > Energy Saver.
    Commands that modify settings must begin with `sudo`.
    More information: <https://ss64.com/osx/pmset.html>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

sudo pmset -b displaysleep 15

click the source code to copy