#!/bin/bash set -e dev=/dev/usb/lp0 # Initialize printer printf '\x1B@' > $dev # Set print speed printf '\x1D(K\2\0' > $dev printf '21' > $dev # Set head energizing printf '\x1D(K\2\0' > $dev printf 'a4' > $dev # 0-4, or \x80 for automatic, default=0