Practice Exams:

LPI 101-500 – 108.4: Manage printers and printing processes

  1. CUPS, lpr, lpq, lpadmin, lpc

This chapter deals with managing printers and printing processes. The printing system used almost exclusively under Linux is called Cups. Cups stands for common Unix printing solution or common Unix printing system. In most operating systems, including including Linux, the printing process is similar. I’m talking about the concept of the queue here. A file that is selected for printing via a program is first placed in a so called printer queue by a print client program, for example Lpr. If there are several files here, there will be processed one after the other. A print queue is also known as a queue or a spooler. In the case of Cups, the queue can be found in the file system within VAR spool cups you need root rights to access this directory.

So let’s be root now CD VAR spool cups files that are now in the corresponding directory for the queue are then picked up by Cups or Lpd, which is another printing system under Linux and processed further. The still unprocessed print data, it is called Raw format are passed on to a so called print filter, which converts the data in a way that is correct for the printer and then sends it to the printer. If the print was successful, the data is selected from the queue. The LP and Lpr commands send print jobs to a printer. This printer must be specified in the command LP is a bit out of date and has largely been replaced by Lpr, which is why I would not expect any detailed questions about LP in the exam.

Let’s take a look at the Lpr Man page lpr so very clearly print files apr submits Files for Printing if you have a printer connected to your home computer, you can try out how you can print from the command line. In that case I would first add my printer via the Cups web interface. You can reach the configuration page at the following address I just open the browser and the address is http localhost and the port number is six three one. Now you can add your printer via administration and then add printer as username and password. You can choose your normal Linux login credentials. So in my case, username and password, we can save it here.

And yeah, in my case my printer appears here because I have already installed the drivers using the printer manufacturer’s installation tool. But I think Cups will recognize the printer also without drivers because it is a network printer in my case. So now you have to find out the exact name of your installed printer. In my case the name is here, I think brother DCpl 25 30 DW so three times the same name. So I think that is no problem. I can choose one of these names. If you have different names here, you can find out yourself via the configuration of the printer, what your exact printer name is. Okay, so I assume that this is my printer name here. Click that. Continue.

And I have to add a name dzpl 25 30 DW and just continue. Now I can search for my manufacturer. It’s Brother. Continue. And here on this page I can search, I can look for my model. It says DCpl and then 25 30 DW. This one here. And then at printer. And now I can do some configurations, media size and so on. I set the default options. And now my printer is configured successfully. Okay, now I’m trying to print directly from the console. I create a test file for this. Let’s go out of here. And then VI printer Test okay, I do some text here. This is printer test. To print the content of this file, I can use the Lpr command with a p option. With the P option we tell Cups with which printer it should print.  So LPRP and then you can use in my case I can switch to Brother and then tap.

And then Apr fills this automatically, my printer name. And then I have to choose the printer file. Printer test file. And then let’s see if my printer turns on. I’m not sure if you can hear this later on my microphone, but I think so let’s try it out. Takes a few seconds sometimes, because it’s a network printer. And I think you can hear my printer. Now. The content of the file printer test was printed successfully. With Lpr you can transfer various other options. Of course I recommend the main page for this. Otherwise here are a few more important options, all of which are introduced with the option O. For example LPR o and then media equals a four so prints in a four format.

Then Lpr with the option O and landscape so prints in landscape format. Or for example lpro fit to page. This option scales the print file to fit the page. The LPQ command can be used to display the printer queue. Here we have to tell Cups which queue so which printer we would like to have displayed. We can also use the p option again with LPQ. So LPQ and the p option. And I choose my brother printer. So my brother printer is ready. No entry, so no printer queue at the moment. Alternatively, we can also use the A option for all Pqa. And the result is that we don’t see any entries, as nothing is currently queued here. At this point I would simply turn off my printer and print a file, so that this file remains in the queue.

Okay, my printer is switched off. And now I start another print. So the same as before. That was my print. And now let’s check the printer queue lpqp. And now we can see something in the queue here. First owner root job five file printer test and file size. Let’s take a look at the file level. CD, VAR, spool, cups. And here you can see these files and I think you cannot look inside these files. Let’s try that out. That’s a template PDF burner show printer name, printer info. But that’s not important for the pig exam. That’s really not important. Okay, so we can, as said before, also use LPQ and A for all. And we have our printer test in the queue too.

Since I would like to save paper at this point, I would like to delete the queue before I turn the printer back on. For this I use the Lprm command. With Lprm two, we have to specify the printer again with the P option and also the order number. This was shown to us in the queue view. So the job number here, it’s the number five in my case. Okay, I will delete this entry now with Lprm and the option P, I use my brother printer again. Now tap doesn’t work, so I have to copy this printer name and then the job number, which is five Lpqa. And here we have confirmation that the queue is empty. Again, you can also use the LPC program. LPC stands for line Printer Control. LPC is an interactive console program.

Let’s try it out LPC. And we see that LPC is now expecting further input from us. With status. We can, for example, query the status of the printer. So status and you see here my printer curing is enabled, printing no entries and so on. There are still various options here. I would advise you to take a look at the man page. But since I did not have any questions about LPC in my exam, and this is also not listed here on the Lpi page, I would say that no questions in this regard are to be expected here. But as I said, just in the case, please have a look at the man page. We previously configured Cups via the web interface, or we added a printer via it.

Of course, there are also configuration files at the file system level that we can use to configure Cups. First of all, there is a file called Etsy Print Cap. So let’s look inside Etsy Print Cap and normally you will find data about your installed printer. In my case there is no data because I think it’s because it is a network printer, and I checked that 2 minutes before as I paused the video. I have not installed any drivers here, so it’s only used by the network. So maybe that’s the point why this file is empty. But please keep that in mind for the exam. There is a file called Etsy Print Cap, and here you can find data about your installed printer. Otherwise you can find all Cups configuration files within Etsy Cups.

And since the Cups web interface is very useful, you will rarely change anything in these files themselves. The printers conf file, for example, has detailed information and settings for the printers normally Viprinters conf. In my case, as before, not very much. Details here. And general settings can be made in the cups D confir. Cups. D conf. And here you have different configuration, different settings, which you can use with the command LP Admin. Various configurations can be made that would otherwise be made with a web interface, which, as I said, should hardly be necessary, thanks to the web interface. But the command would be LP admin. Keep that in mind for the exam.