Skip to content

Instantly share code, notes, and snippets.

@mhdzli
Forked from notdodo/install_printer
Created October 4, 2019 17:48
Show Gist options
  • Save mhdzli/707fa23fa23d07dcc7e2fff0dcbb35d7 to your computer and use it in GitHub Desktop.
Save mhdzli/707fa23fa23d07dcc7e2fff0dcbb35d7 to your computer and use it in GitHub Desktop.
Install a printer on Arch Linux with cups using command line
#!/bin/bash
################################################################
# Install a printer on Arch Linux with cups using command line #
# Used for a HP PSC 1510 with default driver #
################################################################
sudo pacman -S cups
sudo systemctl start org.cups.cupsd
sudo systemctl status -l org.cups.cupsd
# If errors are shown add yourself to 'lp' group
sudo gpasswd -a ${USER} lp
sudo systemctl restart org.cups.cupsd
sudo systemctl status -l org.cups.cupsd
# If errors are shown again add yourself to 'lpadmin' group
sudo gpasswd -a ${USER} lpadmin
sudo systemctl restart org.cups.cupsd
# Find if your device is connected and found by the system
lsusb
# Find the URI
sudo lpinfo -v #
# Find if a driver for your device is installed
lpinfo -m
# Create a print queue with URI and driver
sudo lpadmin -p HP_PSC_1510 -E -v "usb://HP/PSC%201500%20series?serial=MY61DD31P90498&interface=1" -m drv:///sample.drv/deskjet.ppd
# Set as default
lpoptions -d HP_PSC_1510
# Set A4 Page
lpoptions -p HP_PSC_1510 -o PageSize=A4
# Enable printing
sudo cupsenable HP_PSC_1510
sudo cupsaccept HP_PSC_1510
# Restart!!
sudo systemctl restart org.cups.cupsd
# Test printer
lpr test.txt
# List other options
lpoptions -p HP_PSC_1510 -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment