How do I set default printer in my Bash shell under CentOS Linux or FreeBSD unix desktop operating systems?
CUPS is default printing system for Unix and Linux systems. It provides many ways to set the default printer destination. The "LPDEST" and "PRINTER" environment variables are consulted first for the default printer.
Syntax
The syntax is as follows:
export PRINTER=printer-Name-Here
Linux / Unix: Bash Set Default Printer
Open a terminal and edit ~/.bashrc file, enter:
$ vi ~/.bashrc
Set default printer to sales_hplj_1536:
export PRINTER=sales_hplj_1536
OR
PRINTER=sales_hplj_1536 export PRINTER
Save and close the file. Relogin into your account and print a test page using lp* commands such as lp, lpr, lpq, and lprm.
$ cat testfile.txt | lp
OR print ls command man page:
$ zcat /usr/share/man/man1/ls.1.gz | groff -man -Tps | lpr
Linux / Unix: CSH / TCSH Set Default Printer
Edit ~/.cshrc, enter:
$ vi ~/.cshrc
Set default printer to lab_hp8500:
setenv PRINTER lab_hp8500
Save and close the file. Relogin your account and print a test page using standard Unix lp* commands.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop











{ 0 comments… add one now }