Images frequently make up the bulk of a site’s page weight, so it’s important to keep images optimized. Tang Rufus shows how you can use WP-CLI and some binaries to optimize on the command line — with just one command.
As Tang notes, it’s easy to hit 100% CPU usage with a lot of images being optimized in a batch, so be cautious and do it during the quiet hours when visitor traffic is low.