1. Download and unpack WebP tools (it includes the cwebp cli utility that requires to converting images to WebP) https://developers.google.com/speed/webp/docs/precompiled

  2. Set PATH to bin folder where the archive was unpacked

    export PATH=$PATH:~/libwebp-1.4.0-linux-x86-64/bin

  3. Execute in a folder with JPEG images

    for x in ./*.jpg; do cwebp ${x} -o ${x/jpg/webp}; done