| ACADEMIC COMPUTING and COMMUNICATIONS CENTER | |||||||||
Getting Started in UNIX: Printing | ||||
|
||||
| Want to Print Something? | ||||
|
While UNIX command names tend to be very terse, the UNIX operating system
is anything but. Want to print something? The UNIX command apropos
lists available UNIX commands by keyword. (As does the equivalent command:
man
-k )
apropos print | moreon tigger? It lists 109 commands, all of which have something to do with printing. Whew! Fortunately, it's easier to actually print. Here's a quick guide. Remember: case matters on UNIX. So enter all commands in the case shown. (Almost everything is in lowercase, so a good rule to go by is always use lowercase unless otherwise specified.) |
||||
| Printing a File | ||||
If you're a command line type of person: lpr is a basic UNIX
print command:
lpr -P bsb .newsrc lpr -P grc105 hello.psThe -P flag allows you to specify a printer. This is a smart idea, because as of now, the default printer on tigger is grc124b, a nonpublic printer in the Computer Center's main office. (But you can select your own default printer; more about that soon.) .newsrc and hello.ps are the files being printed; lpr can print either plain text or PostScript files, and, in most cases, can even tell the difference. lpr has several other flags; take a look at its man page for more information. In fact, you might want to print a copy: man lpr | lpr -P bsbSubstitute the name of a convenient printer -- that UNIX knows about (see Listing the Available Printers below) -- for the bsb. If you're on tigger and you'd rather use a menu:
Then
use the print command qprt through smit, the AIX "System
Management Interface Tool." To submit a print job completely by menu (and
to see what smit can do, enter: smit
The names of the fields in the menu are in a column on the left; the "Entry Fields," where you actually type, are on the right. Use Up or Down to move from field to field. Don't press Enter or Return (except to make a selection from a pop-up window) until you're ready to submit the print job. You must fill in three fields:
A nice thing about using qprt through smit is that all you have to remember is three fields that you must enter values for; you don't have to remember how to use the menu. There are instructions on the screen and in each pop-up window, and a table at the bottom of the menu showing the keys that execute the necessary functions. In fact, old CMS hands will find that the screen bears a strong resemblance to their favorite full screen CMS menus. |
||||
| Listing the Available Printers | ||||
|
The basic UNIX command to check printer queues, and, incidentally, to list
the names of the printers that the UNIX system knows about, is lpstat.
To display the status of all print queues on tigger, enter: lpstat
(The command is a bit different on icarus: lpstat -a ) On tigger, qchk is another one of the 109 commands the apropos command lists for the keyword print. Like qprt, it is available in AIX, but not necessarily in other flavors of UNIX. So, to check the queue of the printers on tigger, enter: qchk -AAlso like qprt, smit knows about qchk; for a menu interface, enter: smit qchk Don't think that an empty printer queue necessarily means an idle printer; these UNIX commands only know about UNIX print jobs. |
||||
| Selecting a Default Printer | ||||
To select a default printer, set and export the shell variable PRINTER.
Enter the following commands at the $ command prompt:
PRINTER=grc105 export PRINTERThis sets the default printer to grc105; any printer listed by lpstat or qchk -A will do. To have these commands executed each time you login, put them in your .profile file, or in your .env file (introduced in Setting Command Aliases below). Exporting the shell variables allows them to be known in subshells. |
||||
| Setting a Command Alias | ||||
Can't remember "qchk?" I can't either. But I can remember the command printers.
So here's how to set a command alias in the Korn shell (see "What
UNIX shell are you using?") which allows you to enter the command printers
in Korn shell and have UNIX actually execute qchk -A.
alias printers='qchk -A' Put in other aliases if you want; for my account on tigger I also have: alias ls='ls -la' alias mv='mv -if' alias cp='cp -if' alias dir='ls -l' ENV=~/.env export ENV . $ENV
In the Korn shell, your Profile is executed each time you login. When you make a change in it like this, you might want to execute it yourself, to make the changes for your current login session. So to set the alias for your current login, enter: . Profile Note the "period space" at the beginning of this command, and in the last of the three lines you added to your Profile file in Step 2. Yes, it is necessary. The "dot command" tells the shell to run the command as if you has entered the commands yourself at the command prompt. Without it, the command is run in a subshell, and the changes will disappear when the subshell closes. Want to check whether the alias "took"? In Korn shell, the command:
whence
cmdname
Comments are appreciated; send them to |
||||
| The ADN Connection, Nov/Dec 1994 | Previous: Moving Learning Online | Next: What UNIX Shell Are You Using |
| 1999-9-2 connect@uic.edu |
|