CUPS Command Line Interfaces

本文介绍了如何使用CUPS命令行界面来管理打印机,包括添加网络打印机、指定PPD文件、设置打印选项等操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

CUPS Command Line Interfaces


You can also simply use the command line to administer the printers. You can add a network printer enable the printer with:



  # lpadmin -p hplj -v socket://192.168.0.6:9100/ -E

 

Another example for a LPD print server:



  # lpadmin -p lp1nd -v lpd://printhost/lp1nd -E

 

To add information about the Location and a Description of the printer:



  # lpadmin -p lp0 -L "Level 2 South" -D "HP LaserJet 4"

 

To specify a PPD for the printer:



  # lpadmin -p lp7 -P /usr/share/postscript/ppd/HP_LaserJet_4050_Series.ppd
  # lpadmin -p lp11 -P LEXC750.PPD

 

The PPD file is copied into /etc/cups/ppd/lp11.ppd, for example.

You can look at the printer options (assuming it has a PPD) with:



  # lpoptions -p lp7 -l

 

And you can set options with:



  # lpoptions -p lp7 -o PageSize=A4
  # lpoptions -p lp1 -o PageSize=A4

 

And so on. These options are placed in /etc/cups/lpoptions. The same options can be set using the web interface. The web interface is indeed somewhat easier to use, and it modifies the PPD file directly (e.g., /etc/cups/ppd/lp1.ppd) rather than using the /etc/cups/lpoptions file!

You can access printer options directly from the command line when printing, if the printer's PPD supports the option. For example, the HP LaserJet 4050 driver I'm using (from hp-ppd) supports n-up printing and watermarks:



  $ lp -o HPNup=TwoUpL sample.pdf
  $ lp -o HPwmText=Draft odbcmine.pdf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值