Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I dont know if theres any easy way to do this. Im a noob and just setup an old 486sx box running zipslack 7.1....I mainly use this machine to write C programs for one of my classes. I use VI to write the code, but our professor requires we submit the output of hte code also....My 2 computers, this one(XP Pro with Deskjet930 connected via USB) and the 486 box are both networked through a hub in my room which then connects to the wall jack. I can access my windows machine via ftp, so I know that they can talk to each other.
Anyways, I need to know how I can send the output of the code which is displayed in the console to my windows printer...If possible i need step by step instructsions, because im clueless. My zipslack box has no GUI, only the console text mode...thanks in advance
Not sure if this will help, but you can redirect the output of your program to a text file with:
$ ./program_name > output.txt
and then transfer the text file to one of your boxes that has print capabilities. The above command will create the text file in the current directory but you can direct it anywhere by designating the path.
actually, i jsut tried it, is there anyway to have it store the inputs to? It saves the output, however, the things i type, dont show up in the text file
That's what I was afraid of - if you have an interactive program where you must enter a series of inputs it won't work. But there's got to be an easy way to do it. I almost always use a gui and there it's easy; you run your program in a console, highlight everything you want to save with your mouse; create an empty text file and if you click left and right mouse together(or click the wheel if you have one) the highlighted text will be copied to the text file. There's got to be a way to do from the cli but I'm just not that familiar enough with it to give you meaningful advice. I guess the issue is how do you select text from the cli for copying and pasting in a text file.
One thing you might want to consider is downloading knoppix; it's a linux distro that runs entirely of a bootable cd and boots in a gui(kde). It comes with gcc so you should be able to compile programs. Knoppix is fairly ram intensive since it runs in a ram disk so you would probably have to run it on your XP box. However, knoppix has excellent hardware detection and may even pick up your printer on your XP box. The plan would be to boot into knoppix, write your code in any of the many text editors and save it to a floppy; open a console and compile the code and run the program; highlight the output you want to save and save it to a text file on your floppy or if you can print in knoppix save the output to a text file created in knoppix and print it out.
I found it - an easy way. The command you want is called "script". If you run:
$ script output.txt
it will print the entire session to the text file "ouput.txt" starting for everything after you enter the command. Hitting Ctrl-D will stop script from outputting anymore to the file.
Run:
$ man script
for more info on the script command. Here's a quote from the man pages:
Quote:
Script makes a typescript of everything printed on your terminal. It is
useful for students who need a hardcopy record of an interactive session
as proof of an assignment, as the typescript file can be printed out
later with lpr(1).
Sounds like it's right up your alley.
Last edited by kilgoretrout; 11-25-2003 at 04:29 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.