2

I know I can change the characters per inch used by lp with lp -o cpi=12 (or any number you like). But is it possible to change the default value of this option globally? The default, when -o cpi=<N> is not passed, is 10. But I'd like to change this default number to something else so that I do not have to type -o cpi=<mynumber> always and in all scripts I wrote in the past. How can I do this?

4

Use the lpoptions command.

That writes settings to ~/.cups/lpoptions or, if run as root, in the system-wide /etc/cups/lpoptions file.

These settings are used when submitting jobs via lp or lpr, hence changes take effect immediately without the need to restart services.

9
  • Thanks. Do I need to restart any services after changing something? – Foo Bar Dec 1 '14 at 14:33
  • I've edited my answer to provide that info – wurtel Dec 1 '14 at 14:38
  • I used lpoptions -o cpi=12 as root (file was altered according, I checked) followed by lp. But this did not work (it used default cpi, so 10), however when I do lp -o cpi=12 it corretly uses 12. – Foo Bar Dec 1 '14 at 14:44
  • I just did lpoptions, which lists the correct settings (changed cpi), but when I do lpoptions -p <myprinter> then I do not get any cpi settings (it just says none). Do I have to use lpoptions printer-specific? I'd like to set it globally for all installed printers. – Foo Bar Dec 1 '14 at 14:52
  • Should the changes made with lpoptions also appear in printers.conf? (They don't for me) – Foo Bar Dec 1 '14 at 14:59
1

Use the lpadmin command (as root):

lpadmin -p printer -o cpi-default=12

This works immediately, a restart of cups is not required.

(The command adds a line to /etc/cups/printers.conf - might take a while before the new line appears there. If you don't want to wait, you can restart cups which updates printers.conf immediately).

1
  • But my question is actually: How do I change it independent of the printer? So that it works for all printers at once? – Foo Bar Dec 4 '14 at 12:28

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.