LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-16-2002, 06:44 PM   #1
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
Print from command line


Two questions for ya first how do you print from vi? I tried to search here for it but you can't search for vi as it is under 3 letters, then along the same lines how do you print from command line say cat test.txt > ????? I already have my printer installed and working great but as most of my work seems to be at command line this is quite the handicap. Thanks for any info.
 
Old 06-16-2002, 07:23 PM   #2
nincompoop
LQ Newbie
 
Registered: May 2002
Location: Eugene
Distribution: suse, redhat
Posts: 16

Rep: Reputation: 0
I haven't done this from linux, only Solaris, but check out the man pages for "lpr", and maybe "lpq" for a start

Not sure exactly how to make this happen from vi or vim, but I would think you can always save the file first, and then do a lpr "file" from the command prompt.
 
Old 06-16-2002, 08:37 PM   #3
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Original Poster
Rep: Reputation: 30
Thanks for the reply that works great, does anyone know the command for printing while you are in vi, there is alot of times where I will be working on code and want to have a quick printout of if to check some syntex things.
 
Old 06-16-2002, 09:36 PM   #4
nincompoop
LQ Newbie
 
Registered: May 2002
Location: Eugene
Distribution: suse, redhat
Posts: 16

Rep: Reputation: 0
OK, just fired up vi under Redhat 7.2 which tells me it is "vim" (vi improved?). Don't know if this will work but its worth a try.

to run a shell command, say like 'lpr myfile' from within vi(m) do

<esc> to get to command mode, then :!<cmd> where <cmd> is the <cmd> you want like 'lpr myfile' if that worked for you like you said.


so save the 'file' first ("<esc>:w" , then do

<esc>:!lpr 'file'

let me know if that works or doesn't, I haven't tried
 
Old 06-16-2002, 09:57 PM   #5
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Original Poster
Rep: Reputation: 30
Yep works great thank you very much. I had to keep going into gui just to print off my html and php files, seems like a bit of a waste to me, I like spending my time in the command line, I guess it is just a sickness or something.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slack 10; HP 3845; CUPS; Unable to print from command line chrisidaho Linux - Hardware 5 04-27-2005 01:21 AM
print from command line, normally use cups itsjustme Linux - General 2 06-14-2004 11:14 AM
Quick Q: Command to print line number X? KneeLess Linux - Software 1 05-27-2004 07:49 PM
Command line tool to print length of mp3 files? J_Szucs Linux - Software 3 05-04-2004 05:01 AM
Print via OO Writer from command line? MikHud Linux - Software 2 12-13-2002 09:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:45 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