So, I'm pretty new to Ubuntu and basically I'm trying to use a printer via the Ubuntu termial, but I don't know how to do that.

I found on the web some commands that could do the job but I don't know how to configure the printer.

For example this one:


I think I must need to install the drivers or something but I'm not sure if it works as in Windows or not.

Can anyone help me?

Just for the record, the printer is a Xerox.

  • Is the printer installed? Can you print from the GUI?
    – terdon
    Jun 6 '15 at 16:15
  • Try to find out the printer name first, and then test print a simple txt file. If that works, you already have necessary drivers. To find out the name you could use lsusb if you're connecting through usb Jun 6 '15 at 16:17
  • Thanks for your help guys, but I already managed to make it work. It is actualy really easy. Jun 6 '15 at 16:26

It was much easier than I thought. I just had to search for "Printers" in the Ubuntu dash, clicked "Add", searched for network printers, clicked on mine, and voila. That's pretty much it.

Then I just used the following command and everything worked great:


TL;DR Use your default printer with:

lp filename

To specify a default printer or use specific printer, list all printers with

lpstat -p -d


% lpstat -p -d
printer HP-LaserJet-1200 is idle.  enabled since Sa 06 Jun 2015 20:26:19 CEST
printer HP_Color_LaserJet_CP1514n is idle.  enabled since Do 21 Mai 2015 21:02:54 CEST
printer HP_LaserJet_1200 is idle.  enabled since Sa 30 Mai 2015 18:53:31 CEST
system default destination: HP_LaserJet_1200

Print with

lp -d printer filename


lp -d HP_LaserJet_1200 mypdf.pdf

Set a default printer

lpoptions -d printer


lpoptions -d HP_Color_LaserJet_CP1514n

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.