LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-27-2003, 11:38 AM   #1
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Printing From Da' Shell


Hello. I recently installed an HPDeskJet using CUPS. The test page printed out great! Everything prints out perfectly from Mozilla and all the text editors like Kate and KWrite etc.

Sometimes when am doing my thing in the shell I like to quickly print out a certain .conf file to get a better look at it. When I use the lp or lpr commands,(E.G. lp httpd.conf or lpr httpd.conf) the files print out with letters chopped off. The first two or three letters of each line are gone and the first few lines on the top of the file are chopped off as well.

Its not really a big deal since I can just open up an editor and print it from there but I would like the convenience of doing it from the shell if possible. Am I missing a certain flag in the lp command or is this something else?
 
Old 01-27-2003, 02:46 PM   #2
NSKL
Senior Member
 
Registered: Jan 2002
Location: Rome, Italy ; Novi Sad, Srbija; Brisbane, Australia
Distribution: Ubuntu / ITOS2008
Posts: 1,207

Rep: Reputation: 47
You have the specify the prinetr filter to use. Say if my printer name i insatlled with cups/apsfiletr is Epson-high-quality, i would issue:
$ lpr -P Epson-high-quality <filename>
And it should work fine as long as the printer specified is in /etc/printcap. At least it's like this with APSfilter/lpr, i dont use CUPS but i assume it would be the same. Or alternatevily you can try to "low-level" way
$ cat <filename> > /dev/printer or /dev/lp0 depending if the symlinks are correctly in place...
HTH
-NSKL
 
Old 01-27-2003, 02:56 PM   #3
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Original Poster
Rep: Reputation: 57
Well my printer name is HP-DeskJet-3820 so I tried

lpr -P HP-DeskJet-3820 test.txt

and it didn't work. Checking the /etc/printcap file shows a

HP-DeskJet-3820:

entry. The last bit about cat test.txt > /dev/lp0 just locks up the printer. No dice!
 
Old 01-27-2003, 03:04 PM   #4
NSKL
Senior Member
 
Registered: Jan 2002
Location: Rome, Italy ; Novi Sad, Srbija; Brisbane, Australia
Distribution: Ubuntu / ITOS2008
Posts: 1,207

Rep: Reputation: 47
Hmm.. Maybe CUPS doesn't use the "usual" lpr -P thing... I never used it so i'm not much help now... but try to read some CUPS docs, maybe you need to do something like cups -P printername <filename>. I have no idea...
Sorry
-NSKL
 
Old 01-27-2003, 03:11 PM   #5
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Original Poster
Rep: Reputation: 57
Thanks anyway. Maybe I can send the file to an editor such as kate and then have kate print it. Can this all be done from a shell?
 
Old 01-27-2003, 03:22 PM   #6
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
When you give a filename as a parameter to kate at the command-line the file will open, but I'm not sure how you would tie that in to printing.
 
Old 01-27-2003, 03:23 PM   #7
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
Quote:
Originally posted by Crashed_Again
Well my printer name is HP-DeskJet-3820 so I tried

lpr -P HP-DeskJet-3820 test.txt

and it didn't work. Checking the /etc/printcap file shows a

HP-DeskJet-3820:

entry. The last bit about cat test.txt > /dev/lp0 just locks up the printer. No dice!
What do you mean ". . .it didn't work"? Did it not print anything,
or did it print the same stairstep as usual?

How are you setting up the CUPS config file? are you using a
GUI, a web browser, or a text editor?
Post the entry about your printer from /etc/printcap, as well as the
entry from /etc/cups/printers.conf.

The lpr syntax is the same. . .
 
Old 01-27-2003, 03:32 PM   #8
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Original Poster
Rep: Reputation: 57
By saying it didn't work I meant it prints the same stairstep as usual. I am setting up CUPS through the web browser. As I said in my original post everything else prints fine except lp or lpr from a shell.

There is only one line in the /etc/printcap file and it is:

HP-DeskJet-3829:

Here is printers.conf:

# Printer configuration file for CUPS v1.1.18
# Written by cupsd on Sun 26 Jan 2003 04:11:54 PM GMT
<DefaultPrinter HP-DeskJet-3820>
Info HP-DeskJet-3820
Location The-Alter
DeviceURI parallel:/dev/lp0
State Idle
Accepting Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
</Printer>

Shouldn't there be more in the /etc/printcap file?
 
Old 01-27-2003, 04:18 PM   #9
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
Quote:
Shouldn't there be more in the /etc/printcap file?
No. CUPS does things a little differently.

Where did you get the PPD for the printer?
 
Old 01-27-2003, 05:18 PM   #10
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Original Poster
Rep: Reputation: 57
linuxprinting.org
 
Old 01-27-2003, 08:59 PM   #11
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Original Poster
Rep: Reputation: 57
Found a solution.

enscript test.txt

Prints perfectly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'sh' shell - Actually calls legacy Bourne shell, or uses system default? Dtsazza Linux - Software 1 10-28-2005 09:20 AM
[c shell] printing out each line in a file saiz66 Programming 4 10-12-2004 08:15 AM
printing MICR font from Linux shell boyceman Linux - General 1 10-04-2004 10:44 AM
Scribus Printing How to put 4 flyers on a page when printing jazzboy Linux - Software 0 05-02-2004 06:13 AM
Copying VCD ''.dat'' files to HDD in LINUX isaac_linux General 0 11-05-2003 11:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration