Find Out How Your Printers Are Connected


lpstat -s

Laptop users find this next command particularly helpful, as it tells them how they access the printers available to them. When you first set up a printer, you must specify how you connect to it. You have several choices:

  • Local (parallel, serial, or USB)

  • Remote LPD queue

  • SMB shared printer (Windows)

  • Network printer (TCP)

  • Remote CUPS server (IPP/HTTP)

  • Network printer with IPP (IPP/HTTP)

To find out what printers are configured for your computer and how you connect to those printers, use lpstat with the -s option.

$ lpstat -s system default destination: bro device for bro: socket://192.168.0.160:9100 device for bro_wk: socket://192.168.1.10:9100 device for wu: socket://128.252.93.10:9100 


In this case, every printer is a network printer, so it uses socket://, followed by the printer's IP address and its port (9100 is standard for most networked printers, although you might see port 35 used as well). That's pretty easy, but it can quickly get much more complicated.

Although CUPS is user-friendly in many areas, it's famously obtuse when it comes to the Uniform Resource Indicators (URIs) used to indicate the locations of printers vis-à-vis your Linux box. Table 6.1 lists each connection method and the type of URI you might see, which should help you understand the list of printers and URIs you see when you run lpstat -s.

Note

Assume that the printer in the following examples is named bro and located on the network at 192.168.0.160. That isn't relevant in every situation, of course. If the printer is connected via a parallel cable, its IP address doesn't matter.


Table 6.1. Printer Connections and CUPS URIs

Connection Method

Sample URI (Printer bro at 192.168.0.160)

Parallel

parallel:/dev/lp0

Serial

serial:/dev/ttyS1?baud=115200

USB

usb:/dev/usb/lp0

Remote LPD queue

lpd://192.168.0.160/LPT1

SMB shared printer (Windows)

smb://username:password@192.168.0.160/bro

Network printer (TCP)

socket://192.168.0.160:9100

Remote CUPS server (IPP/HTTP)

ipp://192.168.0.160:631/printers/bro, http://192.168.0.160/printers/bro

Network printer with IPP (IPP/HTTP)

ipp://192.168.0.160:631/printers/bro, http://192.168.0.160/printers/bro


Thanks to the rise of network printing in the past several years, it's getting simpler to connect to printers via socket, ipp, or http. Even so, you're still going to run into legacy printers that require the older, more complicated connection methods, so it's good to familiarize yourself with them.

Tip

A bonus is that lpstat -s in essence duplicates the functionality of lpstat -p -d, as it lists all printers known by your system, as well as the default printer. If you want to know all that information quickly, this is a good command to use.




Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net