Skip to content

Instantly share code, notes, and snippets.

@jdmichaud
Last active May 16, 2026 09:44
Show Gist options
  • Select an option

  • Save jdmichaud/cce672c0049e8f0c930e35b1b4e98feb to your computer and use it in GitHub Desktop.

Select an option

Save jdmichaud/cce672c0049e8f0c930e35b1b4e98feb to your computer and use it in GitHub Desktop.
Printer/Printing from the CLI

Basic Options

Get the name of the printer

lpstat -p

Get the options:

lpoptions -p DCP1510 -l

Print:

lp -d DCP1510 file.pdf

Double sided with a non duplex printer:

lp -d DCP1510 -o page-set=odd file.pdf
lp -d DCP1510 -o page-set=even file.pdf

Flip the order so once the odd pages are printed, you print from the last even pages:

lp -d DCP1510 -o page-set=even -o outputorder=reverse file.pdf

Skip the first two page:

lp -d DCP1510 -o page-ranges=3- file.pdf

Select the resolution:

lp -d DCP1510 -o Resolution=2400x600dpi file.pdf

Printing a book

Combining all the options above:

$ lp -d DCP1510 -o page-set=odd -o page-ranges=3-98 -o Resolution=2400x600dpi book.pdf
$ lp -d DCP1510 -o page-set=even -o page-ranges=3-98 -o Resolution=2400x600dpi -o outputorder=reverse book.pdf

This will first print the odd page and then the even page in reverse order. The cover (front and back) will be ignored.

Drivers

By default, linux will use the eSCL/driverless route to connect to the printer. It works for basic stuff but if you want to scan in lossless, eSCL does not support it. Moreover scanning is slow in driverless mode.

To fix this, install brother proprietary driver:

sudo dpkg -i brscan5-1.5.1-0.amd64.deb

But for this to work you need to disable the driverless ipp mode:

# to disable
sudo systemctl stop ipp-usb
# to prevent startup at boot
sudo systemctl mask ipp-usb

To re-enable it:

sudo systemctl unmask ipp-usb
sudo systemctl enable --now ipp-usb

If you do this, driverless printing will also be disabled. Install the proprietary driver:

sudo dpkg -i mfcl2960dwpdrv-4.1.0-1.i386.deb

Check with:

# 1. Queue exists, is enabled, accepting jobs, with the right URI
lpstat -p MFCL2960DW -l
lpstat -v MFCL2960DW
# 2. PPD is in place and CUPS can parse it (no errors mean it's fine)
lpoptions -p MFCL2960DW -l | head -30
# 3. The USB device CUPS sees right now
lpinfo -v 2>/dev/null | grep -i brother

You can then print with:

lp -d MFCL2960DW

Scanning

To scan with good quality without jpeg compression artefact and in True Grayscale (8 bits) not RGB grayscale:

scanimage -d 'brother5:bus5;dev3' \
  --mode 'True Gray' \
  --resolution 300 \
  --source 'Automatic Document Feeder(center aligned,Duplex)' \
  -y 297 \
  --format=png \
  --batch='page%04d.png'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment