diff options
author | Klaatu <klaatu@member.fsf.org> | 2012-06-23 15:58:01 -0400 |
---|---|---|
committer | Klaatu <klaatu@member.fsf.org> | 2012-06-23 15:59:57 -0400 |
commit | c6ce0009d5e53910afd2d5ea1fe357ffc6075fde (patch) | |
tree | 359b8551a7ac9f8c4980ca834b230b017eb10c34 | |
parent | 4fd5956c533959bf1f018238a7d90ed57b989ddb (diff) | |
download | slackbook-c6ce0009d5e53910afd2d5ea1fe357ffc6075fde.tar.xz |
Wrote a printing chapter: CUPS config, printing.conf, lpr, pr
Fixed docbook markup in ch04, ch05, ch01
As per TODO file, added content about more and less in ch04
-rw-r--r-- | TODO | 12 | ||||
-rw-r--r-- | chapter_01.xml | 37 | ||||
-rw-r--r-- | chapter_04.xml | 203 | ||||
-rw-r--r-- | chapter_05.xml | 12 | ||||
-rw-r--r-- | chapter_08.xml | 328 |
5 files changed, 477 insertions, 115 deletions
@@ -20,16 +20,6 @@ Chapter 2. Installation * Need to mention gdisk (for GPT parts) in the partitioning section -* At the tail end we might wish to tell the user about adduser and - inform him that he can skip ahead to chapter 9 briefly if he needs - more info. - -Chapter 4. Basic Shell Commands - -* Section 'Reading Documents' - - Perhaps split this with subsections for cat, more, and less? - Chapter 10. Working with Filesystems * Section 'Network Filesystems' / 'NFS' @@ -44,7 +34,7 @@ Chapter 14. Networking Chapter 16. Basic Networking Commands -* Additional tools to discuss: finger, host, dig, pine, mutt, nail +* Additional tools to discuss: finger, host, dig, nail ps-imgs diff --git a/chapter_01.xml b/chapter_01.xml index 9736ed7..df94f0a 100644 --- a/chapter_01.xml +++ b/chapter_01.xml @@ -2,10 +2,10 @@ <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "/usr/share/xml/docbook/xml-dtd-4.5/docbookx.dtd"> -<chapter> +<chapter id="ch_intro"> <title>Introduction to Slackware</title> -<section> +<section id="intro_why-slackware"> <title>Why Use Slackware?</title> <para> @@ -22,7 +22,7 @@ as well. </section> -<section> +<section id="intro_comparisons"> <title>Differences Compared to Other Linux Distributions</title> <para> @@ -48,15 +48,15 @@ much easier to do whatever you want with your operating system. <para> Also, you may hear users of other distributions say that Slackware has no package management system. This is completely and obviously false. -Slackware has always had package management (see Chapter 16 for more -information). What it does not have is automatic dependency resolution - -Slackware's package tools trade dependency management for simplicity, -ease-of-use, and reliability. +Slackware has always had package management (see <xref +linkend="ch_pkg"/> for more information). What it does not have is +automatic dependency resolution - Slackware's package tools trade +dependency management for simplicity, ease-of-use, and reliability. </para> </section> -<section> +<section id="intro_licensing"> <title>Licensing</title> <para> @@ -69,16 +69,17 @@ you different permissions regarding their use or distribution. <para> Probably the most popular license in use within the Free Software -community is the GNU General Public License. The GPL was created by -the Free Software Foundation, which actively works to create and distribute -software that guarantees the freedoms which they believe are basic rights. -In fact, this is the very group that coined the term "Free Software." -The GPL imposes no restrictions on the use of software. In fact, you don't -even have to accept the terms of the license in order to use the software, -but you are not allowed to distribute the software or any changes to it -without abiding by the terms of the license agreement. A large number of -software projects shipped with Slackware, from the Linux kernel itself to -the Samba project, are released under the terms of the GPL. +community is the GNU General Public License. The GPL was created by +the <ulink url="http://fsf.org">Free Software Foundation</ulink>, +which actively works to create and distribute software that guarantees +the freedoms which they believe are basic rights. In fact, this is +the very group that coined the term "Free Software." The GPL imposes +no restrictions on the use of software. In fact, you don't even have +to accept the terms of the license in order to use the software, but +you are not allowed to distribute the software or any changes to it +without abiding by the terms of the license agreement. A large number +of software projects shipped with Slackware, from the Linux kernel +itself to the Samba project, are released under the terms of the GPL. </para> <para> diff --git a/chapter_04.xml b/chapter_04.xml index 8ffeec3..ec69192 100644 --- a/chapter_04.xml +++ b/chapter_04.xml @@ -2,7 +2,7 @@ <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "/usr/share/xml/docbook/xml-dtd-4.5/docbookx.dtd"> -<chapter> +<chapter id="ch_shell"> <title>Basic Shell Commands</title> <!-- ls, cd, mkdir, touch, rmdir, rm, file --> @@ -15,18 +15,18 @@ probably need a little assistance in knowing how to get around, and that is what this chapter is all about. </para> -<section> +<section id="shell_sysdocs"> <title>System Documentation</title> <para> Your Slackware Linux system comes with lots of built-in documentation -for nearly every installed application. Perhaps the most common method -of reading system documentation is +for nearly every installed application. Perhaps the most common +method of reading system documentation is <application>man</application>(1). <application>man</application> -(short for manual) will bring up the included man-page for any -application, system call, configuration file, or library you tell it -too. For example, <userinput>man man</userinput> will bring up the -man-page for <application>man</application> itself. +(short for <emphasis>manual</emphasis>) will bring up the included +man-page for any application, system call, configuration file, or +library you tell it too. For example, <userinput>man man</userinput> +will bring up the man-page for <application>man</application> itself. </para> <para> @@ -122,7 +122,7 @@ printf (3) - formatted output conversion <application>ls</application>(1) is used to list files and directories, their permissions, size, type, inode number, owner and group, and plenty of additional information. For example, let's list what's in -the <filename>/</filename> directory for your new Slackware Linux system. +the <filename>/</filename> directory for your new Slackware Linux system. </para> <screen><prompt>darkstar:~$ </prompt><userinput>ls /</userinput> @@ -130,7 +130,8 @@ bin/ dev/ home/ lost+found/ mnt/ proc/ sbin/ sys/ usr/ boot/ etc/ lib/ media/ opt/ root/ srv/ tmp/ var/ </screen> -<para>Notice that each of the listings is a directory. These are +<para> +Notice that each of the listings is a directory. These are easily distinguished from regular files due to the trailing /; standard files do not have a suffix. Additionally, executable files will have an asterisk suffix. But <application>ls</application> can do so much @@ -185,7 +186,7 @@ in chapter 5. </section> -<section> +<section id="shell_moving"> <title>Moving Around the Filesystem</title> <para> @@ -224,7 +225,7 @@ shell for you by Slackware.) </section> -<section> +<section id="shell_creating-deleting"> <title>File and Directory Creation and Deletion</title> <para> @@ -240,13 +241,13 @@ file, but if that file doesn't exist, it will be created. </para> <screen><prompt>darkstar:~/foo$ </prompt><userinput>ls -l</userinput> --rw-r--r-- 1 alan users 0 2008-01-18 15:01 bar1 +-rw-r--r-- 1 alan users 0 2012-01-18 15:01 bar1 <prompt>darkstar:~/foo$ </prompt><userinput>touch bar2</userinput> --rw-r--r-- 1 alan users 0 2008-01-18 15:01 bar1 --rw-r--r-- 1 alan users 0 2008-01-18 15:05 bar2 +-rw-r--r-- 1 alan users 0 2012-01-18 15:01 bar1 +-rw-r--r-- 1 alan users 0 2012-01-18 15:05 bar2 <prompt>darkstar:~/foo$ </prompt><userinput>touch bar1</userinput> --rw-r--r-- 1 alan users 0 2008-01-18 15:05 bar1 --rw-r--r-- 1 alan users 0 2008-01-18 15:05 bar2 +-rw-r--r-- 1 alan users 0 2012-01-18 15:05 bar1 +-rw-r--r-- 1 alan users 0 2012-01-18 15:05 bar2 </screen> <para> @@ -314,7 +315,7 @@ bar_2/ </section> -<section> +<section id="shell_archive-compression"> <title>Archive and Compression</title> <para> @@ -361,7 +362,7 @@ archive file. </section> -<section> +<section id="shell_gzip"> <title>gzip</title> <para> @@ -396,8 +397,8 @@ But suppose we don't want to delete the old compressed file, we just want to read its contents or send them as input to another program? The <application>zcat</application> program will read the gzip file, decompress it in memory, and send the contents to the standard output -(the terminal screen unless it is redirected, see the next chapter for -more details on output redirection). +(the terminal screen unless it is redirected, see <xref +linkend="bash_redirection"/> for more details on output redirection). </para> <screen><prompt>darkstar:~$ </prompt><userinput>zcat /tmp/large_file.gz</userinput> @@ -414,7 +415,7 @@ suggestions during this development cycle. </section> -<section> +<section id="shell_bzip2"> <title>bzip2</title> <para> @@ -429,8 +430,8 @@ typicall takes much longer to run than other alternatives. </section> -<section> -<title>XZ / LZMA</title> +<section id="shell_xz-lzma"> +<title>XZ / LZMA</title> <para> The latest compression utility added to Slackware is @@ -449,7 +450,7 @@ with the <arg>-z</arg> argument, and decompression with <arg>-d</arg>. </section> -<section> +<section id="shell_tar"> <title>tar</title> <para> @@ -555,7 +556,7 @@ compression algorithm. </section> -<section> +<section id="shell_reading"> <title>Reading Documents</title> <para> @@ -589,49 +590,127 @@ intelligent people sat down and began to work on an application to let them read documents one page at a time. Naturally, such applications began to be known as "pagers". One of the earliest of these was <application>more</application>(1), named because it would let you see -"more" of the file whenever you wanted. <application>more</application> -will display the first few lines of a text file until your screen is -full, then pause. Once you've read through that screen, you can -proceed down one line by pressing ENTER, or an entire screen by -pressing SPACE. <application>more</application> is also capable of -searching through a text file for keywords. Once you've displayed a -file in <application>more</application>, simply press the / key and -enter a keyword. Upon pressing ENTER, the text will scroll until it -finds the next match. This is clearly a big improvement over -<application>cat</application>, but still suffers from a serious flaw: -<application>more</application> is not able to scroll back up through -the file to allow you to read something you might have missed. Clearly -a better solution is called for. -</para> - -<para> -In order to address the short-comings of -<application>more</application>, a new pager was developed and -ironically dubbed <application>less</application>(1). -<application>less</application> is a very powerful pager that supports -all of the functions of <application>more</application> while adding -lots of additional features. To begin with, -<application>less</application> allows you to use your arrow keys to -controll movement within the document. Due to its popularity, many -Linux distributions have begun to exclude -<application>more</application> in favor of -<application>less</application>. Slackware includes both. Moreover, -Slackware also includes a handy little pre-processor for -<application>less</application> called -<filename>lesspipe.sh</filename>. This allows a user to exectute -<application>less</application> on a number of non-text files. -<filename>lesspipe.sh</filename> will generate text output from running -a command on these files, and display it in -<application>less</application>. +"more" of the file whenever you wanted. </para> +<section id="shell_reading_more"> <!-- sub section of READING --> + <title>more</title> + +<para> +<application>more</application> will display the first few lines of a +text file until your screen is full, then pause. Once you've read +through that screen, you can proceed down one line by pressing ENTER, +or an entire screen by pressing <keycap>SPACE</keycap>, or by a +specified number of lines by typing a number and then the +<keycap>SPACE</keycap> bar. <application>more</application> is also +capable of searching through a text file for keywords; once you've +displayed a file in <application>more</application>, press the / +key and enter a keyword. Upon pressing <keycap>ENTER</keycap>, the +text will scroll until it finds the next match. +</para> + +<para> + This is clearly a big improvement over + <application>cat</application>, but still suffers from some annoying + flaws; <application>more</application> is not able to scroll back up + through a piped file to allow you to read something you might have + missed, the search function does not highlight its results, there is + no horizontal scrolling, and so on. Clearly a better solution is + possible. +</para> + +<note> + <para> + In fact, modern versions of <application>more</application>, such + as the one shipped with Slackware, do feature a + <emphasis>back</emphasis> function via the <keycap>b</keycap> + key. However, the function is only available when opening files + directly in <application>more</application>; not when a file is + piped to <application>more</application>. + </para> +</note> + </section> -<section> +<section id="shell_reading_less"> + <title>less</title> + +<para> + In order to address the short-comings of + <application>more</application>, a new pager was developed and + ironically dubbed <application>less</application>(1). + <application>less</application> is a very powerful pager that + supports all of the functions of <application>more</application> + while adding lots of additional features. To begin with, + <application>less</application> allows you to use your arrow keys to + control movement within the document. +</para> + +<para> + Due to its popularity, many Linux distributions have begun to + exclude <application>more</application> in favor of + <application>less</application>. Slackware includes both. + Moreover, Slackware also includes a handy little pre-processor for + <application>less</application> called + <filename>lesspipe.sh</filename>. This allows a user to exectute + <application>less</application> on a number of non-text files. + <filename>lesspipe.sh</filename> will generate text output from + running a command on these files, and display it in + <application>less</application>. +</para> + +<para> + <application>Less</application> provides nearly as much + functionality as one might expect from a text editor without + actually being a text editor. Movement line-by-line can be done + <application>vi</application>-style with <keycap>j</keycap> and + <keycap>k</keycap>, or with the arrow keys, or + <keycap>ENTER</keycap>. In the event that a file is too wide to fit + on one screen, you can even scroll horizontally with the left and + right arrow keys. The <keycap>g</keycap> key takes you to the top of + the file, while <keycap>G</keycap> takes you to the + end. +</para> + +<para> + Searching is done as with <application>more</application>, by typing + the / key and then your search string, but notice how the search + results are highlighted for you, and typing <keycap>n</keycap> will + take you to the next occurence of the result while + <keycap>N</keycap> takes you to the previous occurrence. +</para> + +<para> + Also as with <application>more</application>, files maybe opened + directly in <application>less</application> or piped to it: +</para> + +<screen> + <prompt>darkstar:~$ </prompt> <command>less + /usr/doc/less-*/README</command> + <prompt>darkstar:~$ </prompt> <command>cat + /usr/doc/less*/README + /usr/doc/util-linux*/README | less</command> +</screen> + +<para> + There is much more to <application>less</application>; from within + the application, type <keycap>h</keycap> for a full list of + commands. +</para> + +</section> <!-- closing less --> +</section> <!-- closing READING --> + +<section id="shell_linking"> <title>Linking</title> +<indexterm> + <primary>symlink</primary> +</indexterm> + <para> -Links are a method of referring to one file by more than one name. By + Links are a method of referring to one file by more than one name. By using the <application>ln</application>(1) application, a user can reference one file with more than one name. The two files are not carbon-copies of one another, but rather are the exact same file, just diff --git a/chapter_05.xml b/chapter_05.xml index 2241c22..93a7bc5 100644 --- a/chapter_05.xml +++ b/chapter_05.xml @@ -2,10 +2,10 @@ <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "/usr/share/xml/docbook/xml-dtd-4.5/docbookx.dtd"> -<chapter> +<chapter id="ch_bash"> <title>The Bourne Again Shell</title> -<section> +<section id="bash_intro"> <title>What Is A Shell?</title> <para> @@ -26,7 +26,7 @@ users should stick to <application>bash</application>. </section> -<section> +<section id="bash_env"> <title>Environment Variables</title> <para> @@ -108,7 +108,7 @@ Password: </section> -<section> +<section id="bash_wildcards"> <title>Wildcards</title> <para> @@ -171,7 +171,7 @@ it as a filename, and since that file doesn't exist, </section> -<section> +<section id="bash_tab-completion"> <title>Tab Completion</title> <para> @@ -188,7 +188,7 @@ matches for you. </section> -<section> +<section id="bash_redirection"> <title>Input and Output Redirection</title> <para> diff --git a/chapter_08.xml b/chapter_08.xml index c9717a2..973b24f 100644 --- a/chapter_08.xml +++ b/chapter_08.xml @@ -2,10 +2,10 @@ <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "/usr/share/xml/docbook/xml-dtd-4.5/docbookx.dtd"> -<chapter> +<chapter id="ch_print"> <title>Printing</title> -<section> +<section id="print_choosing-printer"> <title>Choosing A Printer</title> <para> @@ -32,36 +32,328 @@ firefox, konqueror, or links and go to <imagedata fileref="img/cups-01.png" format="PNG" /> -</section> +<para> + You might find that a quick click-through of CUPS configures your + printer nearly automatically. Or, you may find that further + configuration is required. To learn more about how printing works or + how to get a stubborn printer configured, read on. +</para> + +</section> <!-- closing intro --> + +<section id="print_drivers"> + <title>Getting the driver</title> + +<indexterm> + <primary>printers</primary> + <secondary>drivers</secondary> +</indexterm> + + <para> + There are, essentially, three types of printer drivers: + </para> + + <orderedlist> + <listitem> + <para> + Postscript printers use the unversal-ish language of + Postscript to communicate with computers. A driver for + postscript printers is usually not needed, since a + postscript-compatible subsystem called + <application>Ghostscript</application> is already installed. + </para> + </listitem> + + <listitem> + <para> + Gutenprint are drivers engineered by GNU Linux developers. It + provides support for roughly 700 printers. + </para> + </listitem> + + <listitem> + <para> + Manufacturers may provide Linux drivers for their + printers. Find out by going to the manufacturer's driver and + support website and searching for your model. + </para> + </listitem> + </orderedlist> + + <para> + Since <application>gutenprint</application> is already installed + on Slackware, from this set of three categories, we have two methods of + installing drivers: + </para> + + <orderedlist> + <listitem> + <para> + For the manufacturer's drivers, installation is usually + the same as any other software on your system; use + <application>installpkg</application> or + <application>rpm2tgz</application> to install the driver + package. Be sure to read the documentation bundled with the + drivers. + </para> + </listitem> + + <listitem> + <para> + For Postscript printers, there is no "installation" as + such; simply download the appropriate <filename>PPD</filename> + file and keep it in a sensible location on your hard drive. + </para> + </listitem> + </orderedlist> + + <para> + Once you've located and installed or downloaded the necessary + components, you're ready to run <application>CUPS</application>. + </para> +</section> <!-- close DRIVERS --> <section> <title>Setting Up a Printer in CUPS</title> +<indexterm> + <primary>printers</primary> + <secondary>CUPS</secondary> +</indexterm> + <para> -From this point onward, setting up a printer is just a series of -following the step-by-step instructions with CUPS, but a few areas -merit some clarification. + From this point onward, setting up a printer is just a series of + following the step-by-step instructions with CUPS, but understanding + how the printing configuration actually works might help clarify + what CUPS does is doing. </para> -</section> +<para> + The file <filename>/etc/cups/printers.conf</filename> + consists of definitions which detail the printing devices your + computer will be able to access, with one marked as the default + device. If you wish to edit this file manually (and you probably + don't), you must stop the <application>cupsd</application> + <application>CUPS</application> daemon. +</para> -<section> -<title>Commandline Print Utilities</title> +<para> + A typical entry would look something like this: +</para> + +<programlisting> + <Printer r1060> + Info Ricoh 1060 + Location Downstairs + MakeModel Ricoh Aficio 1060 - CUPS+Gutenprint v5.2.6 + DeviceURI lpd://192.168.4.8 + State Idle + StateTime 1316011347 + Type 12308 + Filter application/vnd.cups-raw 0 - + Filter application/vnd.cups-raster 100 rastertogutenprint.5.2 + # standard-ish stuff below here + Accepting Yes + Shared No + JobSheets none none + QuotaPeriod 0 + PageLimit 0 + KLimit 0 + OpPolicy default + ErrorPolicy stop-printer + </Printer> +</programlisting> + +<para> + In this example, we have given the printer the name + <userinput>r1060</userinput>, a human-readable identifier + <userinput>Ricoh 1060</userinput>. +</para> + +<para> + The <userinput>MakeModel</userinput> attribute is gained from + <application>lpinfo</application>, which lists all available + printer drivers on your system. So, if you know that you have a + Ricoh 1060 that you want to print to, then you would issue this + command as root: +</para> + +<screen> + <prompt>darkstar:~# </prompt><command>lpinfo -m | grep 1060</command> +</screen> + +<para> + This lists the drivers that you have installed, grepping for the + string 1060: +</para> + +<programlisting> + gutenprint.5.2://brother-hl-1060/expert Brother HL-1060 - CUPS+Gutenprint v5.2.6 + gutenprint.5.2://ricoh-afc_1060/expert Ricoh Aficio 1060 - CUPS+Gutenprint v5.2.6 +</programlisting> + +<para> + The <userinput>MakeModel</userinput> is the last half of the + appropriate result; in this case <userinput>Ricoh Aficio 1060 - + CUPS+Gutenprint v5.2.6</userinput> +</para> + +<para> + The final vital entry is the device URI, or where on the network + (or physical location, such as the USB port), the printer + can be found. In this example, we use <userinput>DeviceURI + lpd://192.168.4.8</userinput> because we are using the + <application>lpd</application> (line printer daemon) + protocol to send data to the printer. +</para> + +<para> + Now you understand what is being configured, and you can use the + more common (and easier) method of doing this from the + configuration tool that runs inside of a web browser. +</para> + +<para> + In the CUPS interface, choose the <guimenu>Administration</guimenu> + tab, and choose to <guibutton>Add Printer</guibutton>. You should + be asked to enter administrative authorization here; enter + <userinput>root</userinput> as the admin and your <userinput>root + password</userinput>. +</para> + +<para> + You will be presented with a list of printer interfaces and + protocols that you can use for a printer. In many cases, you will + want to add the printer via the + <application>LPD/LPR</application> protocol (unless you've + managed to find a printer that requires some other protocol). +</para> <para> -Using the command <command>lpr</command>(1) to print files, is a simple task. -It can queue a print job using a file or standard input (stdin). -Refer to the manpages for more options. + Note that if the printer is plugged directly into your computer, and + is on, you should see it listed as a Local Printer. </para> <para> -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do -eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad -minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip -ex ea commodo consequat. Duis aute irure dolor in reprehenderit in -voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Assuming the printer is networked, the next screen will ask for the + location of the printer. Using lpd:// as the protocol, + enter the IP address of the printer. To find the IP address of the + printer, you will probably need to look at the printer's + settings, or you may be able to determine it from your router. </para> -</section> +<para> + Whether your printer is connected via USB or network, the following + screen will ask for human-readable details about the printer; this + is for your reference only, so enter a name for the printer that + makes sense to you and your users (the model number + usually), a description (something that is distinctive about + the printer if you have more than one of the same printers), and + the location (describing where it is in the building). +</para> + +<para> + On the next screen, point CUPS to the printer driver. If the + printer is a postscript printer (as most laserprinters are) + then you may need only the <filename>PPD</filename> for that + printer. If your printer is not postscript or has special features + that require additional drivers, then define the make + (manufacturer) and you will then be presented with a list of + available drivers. Select the appropriate driver. +</para> + +<para> + The printer is now installed and will be the default printer for all + of your applications. +</para> + +</section> <!-- closing CUPS --> + +<section id="printing_lpr"> + <title>Printing from the Command Line</title> + + <para> + Now that you have successfully installed and configured your + printer, you may also use <application>lpr</application> to print + from the command line. + </para> + + <para> + <application>lpr</application> sends documents to a printer but + before using it, you might want to define a default printer by + using <application>lpadmin</application> as root: + </para> + + <screen> + <prompt># </prompt><command>lpadmin -d r1060</command> + </screen> + + <para> + In this example, <userinput>r1060</userinput> is the human + readable name given to the printer in either + <filename>/etc/cups/printers.conf</filename> or in + the <application>CUPS</application> configuration. + </para> + +<note> + <para> + If you do not have root privileges on the workstation you are + using, you can also set the <userinput>PRINTER</userinput> + environment variable: + </para> + + <screen> + <prompt>$ </prompt><command>PRINTER=r1060</command> + <prompt>$ </prompt><command>export PRINTER</command> + </screen> +</note> + + <para> + Once the printer has been set, then you may print: + </para> + + <screen> + <prompt>$ </prompt><command>lpr foo.txt</command> + </screen> + + <section id="print_lpr_pr"> + <title>Formatting for Print</title> + + <para> + <application>lpr</application>, like so many other UNIX + applications, does one thig: sends files to a printer. It + doesn't much care if the file looks good or even fits on a + page. When printing large text files that have not been + formatted for print, use <application>pr</application>(1). + </para> + + <para> + <application>pr</application> is a simple text formatter that + takes any text document and makes sure that it contains line + breaks and page breaks, with an optional header and footer, page + numbering, and much more. It has many options, but the defaults + are usually good enough. <application>pr</application> outputs + the results of the formatting to standard out, meaning it simply + takes the text document, formats it, and displays the results in + the terminal. This, of course, means that it can be redirected + to <application>lpr</application>: + </para> + + <screen> + <prompt>darkstar:~$ </prompt><command>pr foo.txt | lpr</command> + </screen> + + <para> + This will format <filename>foo.txt</filename> and send the + formatted output to the default printer. + </para> + + <para> + As usual, see the <application>pr</application> man page for a + list of the customizations you can make to the default formatting. + </para> + +</section> <!-- closing pr --> +</section> <!-- closing lpr --> </chapter> |