Debian is an extremely popular Linux distribution known for its stability and security. If you’re managing printers on a Debian-based system, you’re in luck! Debian provides several tools and commands that allow you to easily configure and manage printers from the command line using bash.
1. CUPS (Common UNIX Printing System)
CUPS is the default printing system in Debian and many other Linux distributions. It provides a web-based interface to configure and manage printers, but you can also interact with CUPS using bash commands.
To install CUPS, open a terminal and run the following command:
sudo apt-get install cups
Once installed, you can access the CUPS web interface by opening your web browser and navigating to http://localhost:631. From here, you can configure printers, view print queues, and manage print jobs.
2. lpadmin
The lpadmin
command is used to add, modify, or delete printers in CUPS. It also allows you to set printer options such as paper size, print quality, and duplex mode. Here’s an example of how to add a printer using lpadmin
:
lpadmin -p PrinterName -E -v URI -m ModelPath
PrinterName
is the name you want to assign to the printer.URI
is the location of the printer, such assocket://192.168.1.100
for a network printer orusb://PrinterName
for a USB printer.ModelPath
is the path to the printer driver/model file.
3. lp
Once you have added a printer using lpadmin
, you can use the lp
command to print files. It provides various options for printing, such as specifying the number of copies, page range, and print quality. Here’s an example:
lp -d PrinterName -n 3 -o sides=two-sided-long-edge filename.pdf
PrinterName
is the name of the printer you want to use.-n 3
specifies the number of copies to print (in this example, 3 copies).-o sides=two-sided-long-edge
sets the print option to duplex printing.filename.pdf
is the name of the file you want to print.
4. lpstat
The lpstat
command is used to display information about printers and print jobs. It can show the status of printers, print queues, and active print jobs. Here are a few examples:
To check the status of all printers:
lpstat -p
To view the print queue for a specific printer:
lpstat -o -d PrinterName
To view the status of all print jobs:
lpstat -W completed -u
These are just a few examples of how you can manage printers on Debian using bash commands. The combination of CUPS, lpadmin, lp, and lpstat provides a powerful set of tools for printer management. Whether you prefer the command line or a web interface, Debian has you covered when it comes to managing printers.