Simple howtos

This collection of mini howtos is a dynamic copy of the Unix Toolbox. This page extracts the XML content directly from the original XHTML DOM and displays only the requested node. Source code here (use "save as").
Unix Toolbox revision 14.4
Copyright (c) 2007-2012 Colin Barschel. Some rights reserved under Creative Commons [Attribution - Share Alike]
System
Processes
File System
Network
SSH SCP
VPN with SSH
RSYNC
SUDO
Encrypt Files
Encrypt Partitions
SSL Certificates
CVS
SVN
Useful Commands
Install Software
Convert Media
Printing
Databases
Disk Quota
Shells
Scripting
Programming
Online Help

Printing

Print with lpr

# lpr unixtoolbox.ps                 # Print on default printer
# export PRINTER=hp4600              # Change the default printer
# lpr -Php4500 #2 unixtoolbox.ps     # Use printer hp4500 and print 2 copies
# lpr -o Duplex=DuplexNoTumble ...   # Print duplex along the long side
# lpr -o PageSize=A4,Duplex=DuplexNoTumble ...
# lpq                                # Check the queue on default printer
# lpq -l -Php4500                    # Queue on printer hp4500 with verbose
# lprm -                             # Remove all users jobs on default printer
# lprm -Php4500 3186                 # Remove job 3186. Find job nbr with lpq
# lpc status                         # List all available printers
# lpc status hp4500                  # Check if printer is online and queue length
Some devices are not postscript and will print garbage when fed with a pdf file. This might be solved with:
# gs -dSAFER -dNOPAUSE -sDEVICE=deskjet -sOutputFile=\|lpr file.pdf
Print to a PDF file even if the application does not support it. Use gs on the print command instead of lpr.
# gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=/path/file.pdf