How do I add a printer in Linux?

To view a step-by-step screencast of this process, click here.

To add a printer:

  • Log into the server as root
  • If you are using Eterm instead of PuTTY (not recommended), make sure to set the appropriate TERM variable:
export TERM=vp
  • Create driver file:
    • NOTE: Replace lp1 with the name of the printer being configured (lp1, lp20, etc.)
echo "lpr -P lp1" > /usr/spool/uv/
chmod +x /usr/spool/uv/
  • Create queue in UV:
cd /u2/uv; uv
  • Create queue in UV:
    • NOTE: Replace lp1 with the name of the printer being configured (lp1, lp20, etc.)
    • Spooler -> Device -> Maintain
    • Use ENTER to advance, selecting all defaults unless otherwise specified.
    • Name = LP1 (shows all caps)
    • Path = /dev/null
    • Driver = (ignore error)
    • Lock = lock.lp1
    • Press Enter several times, accepting the defaults, until done.
    • ESC -> Q -> ENTER to exit
  • Create the Linux print queue, with the following variables adjusted appropriately:
    • lp1: the name of the printer being configured (lp1, lp20, etc.)
    • socket: the communications protocol to be used. While the default socket setting works for most printers, some Zebra and other printers prefer to use the lpd communications protocol (lpd://).
    • lp1 or the hostname or IP address of the printer
/usr/sbin/lpadmin -p lp1 -E -v socket://lp1
  • If you created the print queue using a hostname (ie lp1) instead of an IP address (ie in the previous step, you’ll need to make certain the server can resolve the hostname. If you have not yet added the hostname to your /etc/hosts file, do so now using the following command (take note the double greater-than symbols):
echo "     lp1" >> /etc/hosts 
  • The printer is ready for use by Eclipse

13 thoughts on “How do I add a printer in Linux?”

  1. Please revise to show variables. For instance, if I am creating printer LP21, then should all the references be to lp21 instead of lp1 as shown? Example: Driver = – if my printer will be LP21, then should this read Driver = The article is not clear on that point. The same for the last command which has an IP address listed – is that supposed to be the IP address of the printer, the server, or ?

  2. When setting up the entry in the Linux print queue, you should also mention the other type, “lpd”. I have noticed that wireless printers (Zebra QL420) and some print servers (AXIS) like the “lpd” much better than “socket”

  3. This is a great document. The only thing I would add as well is that I get en error message after the command cd /u2/uv; uv that says Sorry, terminfo kcuf1 capability is required.
    So in order to get into universe I have to do the following instead:
    cd /u2/uv
    export TERM=vp
    Then I am apple to proceed to spooler/device and maintain devices.


    1. Kris,

      Thanks for the tip — I’ve added it to the article. In most cases, our team uses a full-featured terminal emulator like PuTTY for “root” administration, while we continue to use Eterm for logging into Eclipse.



  4. Sorry I had a miss type on that. After you get that error you have to do a Q to quit then do the
    export TERM=vp
    cd /u2/uv: uv

  5. You may want to re-word the following: “•If you are using Eterm instead of PuTTY (not recommended), make sure to set the appropriate TERM variable:” to make it •If you are using Eterm (not recommended), instead of PuTTY make sure to set the appropriate TERM variable:

  6. The screencast ends at: /usr/sbin/lpadmin -p lp1 -E -v socket://lp1, except for they used the IP address instead of the lp# BUT the screencast didn’t mention the next step shown here:
    echo “ lp1″ >> /etc/hosts, so to do or not to do???? and if so, how many spaces are there between the ip# and lp1” ?

    1. Sharon,

      You may use either the IP address or a hostname (ex lp1), but most customers prefer to use a hostname to ease administration. If you do not have DNS entries for each of your printers, you will need to add each hostname to the server’s /etc/hosts file. To do so, you may either open the /etc/hosts file in the text editor of your choice (vi, gedit, etc.), or you may use the following command (the number of spaces does not matter, as long as the order is IP address then hostname):

      echo “IP ADDRESS HOSTNAME” >> /etc/hosts



  7. One of my departments has requested I set them up with a null printer in Eclipse. I think I have accomplished this by following your instructions on this page, but stopping after the UV setup, and not creating the Linux queue.

    I have tested and it appears to be working as a null printer, I don’t see any list of jobs building up in the UV queue… but I want to get your feedback on if this will work, or cause problems (ie:building up a huge number of jobs.)


    1. Or perhaps not even the UV setup is needed? Just put a printer into the Assign Printers in Eclipse, with no driver file or queue creation, and the jobs will just dump harmlessly into the nothingness?

      1. Theoretically, you could create a UniVerse queue that points to /dev/null. If you send jobs from Eclipse to a non-existent UV queue, you may see errors.

Comments are closed.