• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Add Network Printer via Command Line in CentOS/RHEL

by admin

This post explains the steps to add a network printer on a Linux Server.

1. Verify if new printer already exists

# lpstat -p
Note: This command will list all installed printers.

2. Verify if printer has a DNS record:

# host [printer name]

3. If error found in verifying if printer has a DNS record, modify /etc/hosts:

# echo "[printer IP address] [printer name]" >> /etc/hosts
Note: Modifying /etc/hosts can be done manually by using vi command.

4. Add printer:

# lpadmin -p [printer name] -E -v socket://[printer name]:[port]

5. Verify if printer has been installed successfully:

# lpstat -p | grep [printer name]

or

# ping [printer name]
Note: Do not modify /etc/cups/printers.conf configuration file directly. Use the lpadmin command to add or remove printers.
How to Remove Network Printer in CentOS/RHEL

Filed Under: CentOS/RHEL, CentOS/RHEL 6, CentOS/RHEL 7, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. How to Find Number of CPU Sockets on a CentOS/RHEL System
  2. How to Recover from a Corrupted or empty /etc/mtab file in CentOS/RHEL 7
  3. How to truncate /var/log/lastlog File
  4. CentOS / RHEL : How to install a specific version of rpm package using YUM
  5. How to add Swap Space on Linux Servers (CentOS/RHEL) On the Fly
  6. Basic Linux File system tutorial – ext2, ext3, ext4, JFS and XFS
  7. Permission Table for a File/Directory And File System Users Types
  8. systemd command line reference (cheat sheet)
  9. How to find and delete files older than some particular time period in Linux
  10. RHEL 7 – RHCSA Notes : Configure a system to use time services

You May Also Like

Primary Sidebar

Recent Posts

  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found
  • macof: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright