UNIX For Dummies [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

UNIX For Dummies [Electronic resources] - نسخه متنی

John Levine, Margaret Levine Young

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Finding Your Printout

As far as UNIX is concerned, its only job is to send your file to the printer. Now the real work begins: finding your printout.

Network If your UNIX system is attached to a network, chances are that your printer is attached to some other computer rather than to yours. You may have to go looking for it to find your printouts.

You may have to ask people in nearby cubicles or stand still in the center of the office and listen for the sound of printing (a gentle whir and click from most laser printers). If all else fails, ask your system administrator. Because your UNIX system may be capable of using more than one printer, your system administrator may be the only person who can tell you which printer your printout is on.
Aha! There’s the printer! If you’re lucky, no one else printed anything recently, so the paper on top of the printer is all yours. More likely, lots of people printed stuff, and a pile of paper is on top of the printer — only some of which is yours.

With luck, every printout has in front of it a sheet that identifies the file that’s printed, with the username, time, and other odds and ends that seemed relevant to the person who configured the printer. Rooting through the stack, picking out your own pages, and leaving the rest in a heap is considered tacky. Instead, separate the printouts and leave them on the table or in printout racks (if available) with the usernames visible. With luck, others do the same for you. If you can’t find your printout on the printer, maybe someone else already separated and stacked the printouts. Or maybe other users decided that your printout looked more interesting than theirs and took it off the printer to read it.


Printers, printers, everywhere


A reasonably large installation probably has several printers, either because one printer can’t handle all the work or because the installation uses different kinds of printers. When you use the lp or lpr command, UNIX picks one printer as the default. If you use lp , you use the -d option (that’s a lowercase d — remember that UNIX cares about these things) to identify the printer. To print your file on a printer named draft , for example, you type

lp -ddraft myletter

If you use lpr , the analogous option is -P (that’s an uppercase P), so the command you type is

lpr -Pdraft myletter

In either case, don’t type a space between the -d or -P and the printer name.


Calling all printers


The list of available printers depends entirely on the whims of the system administrator. Typically, one day she gets tired of putting up with the slow, illegible, or chronically broken previous printer, storms into the boss’s office, gets the necessary signature, and buys the first printer available. Sometimes the old printer is thrown away, sometimes not.
Getting a list of printers known to the system is generally not too difficult. If you use the lp command to print, type this line to get a list of available printers:


lpstat -a all

This line means roughly, “Show me the status of all printers that are active.” The lpstat program lists the status of all available printers, one per line, like this:

dj accepting requests since Thu Apr 26 13:43:50 2001
In this case, only one printer, whose name is dj , is available. The listing also shows you the vital fact that it was installed on a Thursday afternoon in April 2001. Whoopee.

Linux If you use the lpr command to print, try typing this line to get the same information:


lpq -a









Tip Woodsman, spare that file!


When you tell UNIX to print a file, the file doesn’t print immediately. UNIX makes a note to print the file and remembers its filename.

What if you delete the file before UNIX has a chance to print it? If you print with lp , you get a nasty message because UNIX can’t find the file. If you print with lpr , the file prints normally because UNIX makes a copy of the material to print.

To force lp to copy the file, use the < command-line operator. To send a copy of the file myfile to the printer, for example, type

lp < myfile

You can then delete or change myfile and not affect the printout.

If you are printing a large file, lpr can take a long time to make the copy of the file (which it doesn’t really need to do because it’s already in a file in the first place, isn’t it?). You can use lpr -s to tell UNIX to print from the original file to save time and hard drive space. If you use the -s option, be sure not to delete or change the file until it’s printed.

You can tell lpr to delete the file when it finishes printing it. This capability is sometimes useful when you made the file in the first place only so that you could print it. Use the -r option to remove the file after printing:


lpr -r myfile

For large files, you can use -r and -s together:


lpr -s -r myfile











The lpq program responds with a similar list:

lp:
Rank Owner Job Files Total Size
1st johnl 7 longletter 4615 bytes
ps:
no entries
The lpq command stands for something like line printer query, and -a means all printers. In this case, two printers are available, named lp and ps , and something is printing on the first one.

Keep in mind that not every printer the lpstat and lpq commands report to is usable. System administrators frequently put in the table of printers some test entries that don’t really represent printers you can use.

/ 213