列出额外的CUPS打印机信息

如何使用命令行工具显示打印机信息,例如打印机描述或打印机位置?

lpstat -t列出打印机的打印机名称,类别和设备,但不会列出打印机说明或位置。 有没有办法获得这个信息,而不使用HTTP或GUI界面?

您可以使用lpstat -l -p printername获取此信息。

 [root@Valley ~]# lpstat -l -p zebra2 printer zebra2 is idle. enabled since Tue Jun 8 15:50:35 2010 Form mounted: Content types: any Printer types: unknown Description: Zebra 105SL in shipping Alerts: none Location: Shipping Connection: direct On fault: no alert After fault: continue Users allowed: (all) Forms allowed: (none) Banner required Charset sets: (none) Default pitch: Default page size: Default port settings: 

这是一个更全球化的一切,消除了grep的声明。

 for i in $( lpstat -v | awk '{ print $3 }' | tr ':' ' ' ) ; do lpstat -l -p $i | grep 'printer\|Location' ; done