LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Print from command line (https://www.linuxquestions.org/questions/linux-newbie-8/print-from-command-line-23575/)

cli_man 06-16-2002 06:44 PM

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.

nincompoop 06-16-2002 07:23 PM

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.

cli_man 06-16-2002 08:37 PM

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.

nincompoop 06-16-2002 09:36 PM

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

cli_man 06-16-2002 09:57 PM

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.


All times are GMT -5. The time now is 06:22 AM.