Skip to content

Instantly share code, notes, and snippets.

@notdodo
Last active June 15, 2024 06:35
Show Gist options
  • Save notdodo/660a2a67b9bc8a815ba537530137636a to your computer and use it in GitHub Desktop.
Save notdodo/660a2a67b9bc8a815ba537530137636a 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
@abdolaab
Copy link

Thanks a lot, I even didn't know if the driver was installed, I am using Sumsung M2020.

@shwaybotx
Copy link

There is a small error on line 43.
sudo cupaccept HP_PSC_1510 is incorrect.
It should read:
sudo cupsaccept HP_PSC_1510

@notdodo
Copy link
Author

notdodo commented Jul 15, 2019

Thank you @shwaybotx. It's fixed now

@shwaybotx
Copy link

shwaybotx commented Jul 15, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment