gifsicle -i input.gif -k 64 -O3 -o output.gif

Optimize batch:

gifsicle --batch -i -O3 --no-comments *