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

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

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

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

John Levine, Margaret Levine Young

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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






“Help! I’ve Printed, and It Won’t Shut Up!”

The first time you print something large, you suddenly will realize that you don’t really want to print the file because you have found a horrible mistake on the first page. Fortunately, you can easily tell UNIX that you have changed your mind.

Warning If you tell UNIX to print a file that does not contain text, such as a file that contains a program or a database, in most cases UNIX prints it anyway. In a classic example of Murphy’s Law (anything that can go wrong will go wrong), files like that tend to print about 12 random letters on each of 400 pages. Every page has just enough junk on it that you can’t use that piece of paper again. As you may expect, people who print a large number of files like that tend to become unpopular, particularly with coworkers whose 2-page memos are in line behind the 400 pages of junk.


Cancel the order, System V


If you used lp to print the file in the first place, you use cancel (we don’t know how that name slipped past the lazy typists) to cancel the print job. You have to give the cancel command the request ID that lp assigned to the job. If you’re lucky, the lp command is still on-screen, and you can see the request ID. If that information has vanished from your screen, remain calm. Remember that the lpstat command lists all the requests waiting for the printer. Type this command:

lpstat

This command displays a list like the following:

dj-2620 johnl 34895 Dec 23 21:12 on dj
This list tells you that your request was named dj-2620 , it was done on behalf of a user named johnl , the size of the file to be printed is 34895, and the print command was given on December 23. You can cancel the request with this command:


cancel dj-2620

UNIX responds with this line:

request "dj-2620" cancelled
UNIX has a surprisingly convenient (surprising for UNIX, anyway) shortcut you can use. If you give the name of a printer, UNIX cancels whatever is printing on that printer. If you remember that the local printer is named dj , you can type the following line to cancel whatever dj is printing:


cancel dj


Cancel the order, BSD


Linux If you made your printing mistake with the lpr command, you use lpq to find out the request ID, which — to add confusion — is called a job number here. Just type this command:


lpq

UNIX responds with a list of print jobs:

Rank Owner Job Files Total Size
1st johnl 12 blurfle 34895 bytes
You need to note the job number (12, in this case). Use that number with the lprm command, which, despite its name, removes the request to print something and not the printer itself:


lprm 12

The lprm command usually reports something about "dequeued" lines; this information is meant to be reassuring, although it’s not clear to whom. In response to the lprm 12 command, for example, UNIX displays this message:
dfB012iecc dequeued
cfA012iecc dequeued








Technical Stuff Why you don’t want to know about PostScript


You may have what’s known as a PostScript printer. Two general camps of laser-printer design exist: the Hewlett-Packard (HP) camp and the PostScript camp. Printers in the Hewlett-Packard camp are based on the design of the HP LaserJet line of printers. Printers in the PostScript camp use the PostScript programming language designed by Adobe Systems. LaserJet printers are said to speak PCL, although PCL is not nearly as complicated or flexible (depending on how you look at it) as PostScript. To add to the confusion, most laser printers produced in recent years speak both PostScript and PCL.

You may reasonably ask, “What does a programming language have to do with a printer?” If you send to the simpler LaserJet a file that contains the text Your mother wears army boots, the printer prints Your mother wears army boots . If you send the same file to a PostScript printer, the printer doesn’t print anything. The reason is that a PostScript printer is a powerful computer with a built-in programming language (that’s PostScript) that can print stuff sort of as a sideline. To make a PostScript printer print anything, you have to send it a program to do the printing. Fortunately, this type of program is widely available.

This arrangement isn’t quite as deranged as it sounds. To print simple files of text, it’s a pain; for fancy typeset documents with lots of typefaces and figures and line drawings and such things, however, PostScript is considerably more flexible than PCL, enough so that people use PostScript to typeset entire books (such as this one).

PostScript has two problems that may bite you. The first is sending a regular file to a PostScript printer. UNIX printer software is usually smart enough to figure out automatically that it must PostScript-ize the file in order to print it. If the printer software is not that smart, another program can do the PostScript-ization. Adobe, the originator of PostScript, sells a widely used package named Transcript. It includes a program named enscript that prints plain files. If the plain lp or lpr command doesn’t work, try using the enscript command or its freeware clone nenscript before you run for help.

The other problem you may encounter is that a file contains PostScript but prints like a regular file. PostScript files look like incomprehensible programs written in an obscure programming language because that’s what they are. The tipoff is that the first two letters on the first line are %! . To see what the file is supposed to look like, you must send it to a PostScript printer that can run the program in the file and print whatever the file contains. If your printer prints the PostScript program instead, most likely your printer doesn’t speak PostScript.

Lacking a PostScript printer, you still may not be out of luck. A program from the Free Software Foundation named Ghostscript can read PostScript files and translate them into something your local printer can print. Later in this chapter — in “Printing for the PostScript-Challenged,” to be precise — we discuss Ghostscript and its cousin Ghostview, which lets you preview PostScript documents on-screen.












Some final words about stopping the printer


Most printers have something called an internal buffer, which is where data to be printed resides before the printer prints it. An internal buffer is good and bad: It’s good because it keeps the printer from stopping and starting if the computer is a little slow in passing your file to it. It’s bad because, after data is in the buffer, the computer cannot get it back. So, even after you cancel something you want to print, some of it may still be in the buffer: as much as 2 pages of normal text or about 20 pages of the junk that results from printing a non-text file.

Warning You have no easy way to keep from printing the stuff in the printer buffer. One really bad idea is to turn the printer off in the middle of a page: This method tends to get the paper stuck and, on laser printers, lets loose a bunch of black, smeary stuff that gets all over your hands and on the next 1,000 pages the printer prints. If you insist, press the printer’s Stop or Off-line button and wait for the paper to stop moving. Then you can turn the printer off relatively safely. Or, with luck, a button on the printer provides a Cancel option to discard what’s waiting in the printer.

After you cancel your print request, the printer probably still has half a page of your failed file waiting to print. You can eject that page by pressing a button on the printer labeled something like Form Feed or Print/Check or even Reset.

/ 213