% lp filenameReplace 'filename' with the name of the file to print. The file prints without opening an application. This works for text, PDF, PostScript, and many graphics files. You can also type
% lp[space]where [space] represents hitting the space bar. Then, drag the file icon to the terminal, and hit Return. The file will print regardless of your directory.
I wrote the following (very simple) AppleScript application to go one step farther and print a file(s) dropped onto its icon. Type the following into the Script Editor, or download the text file and paste it into the editor:
on open fileListNote that there is a space after /usr/bin/lp in both of the "do shell script" lines.
display dialog ¬
"Print file(s) using the default CUPS printer?" ¬
buttons {"OK", "Options", "Cancel"} ¬
default button "OK"
set doWhat to button returned of result
if (doWhat = "OK") then
repeat with theItem in fileList
set thePath to POSIX path of theItem
do shell script "/usr/bin/lp " & thePath
end repeat
else if (doWhat = "Options") then
display dialog "Enter options for the lp command:" ¬
default answer ""
set theOpts to the text returned of result
repeat with theItem in fileList
set thePath to POSIX path of theItem
do shell script "/usr/bin/lp " & theOpts ¬
& " " & thePath
end repeat
end if
end open
Save the file as an Application and put it in a convenient location. If you drop an appropriate file on the icon, it will print. If you add the application to your Dock, you can just drop the file on the Dock Icon, and it will print.
Read the UNIX man page for lp (enter "man lp" no quotes) to find out about the options that you can use.

