From c6ce0009d5e53910afd2d5ea1fe357ffc6075fde Mon Sep 17 00:00:00 2001 From: Klaatu Date: Sat, 23 Jun 2012 15:58:01 -0400 Subject: 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 --- TODO | 12 +-- chapter_01.xml | 37 +++---- chapter_04.xml | 203 ++++++++++++++++++++++++----------- chapter_05.xml | 12 +-- chapter_08.xml | 328 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 477 insertions(+), 115 deletions(-) diff --git a/TODO b/TODO index b50fede..7d96c0f 100644 --- a/TODO +++ b/TODO @@ -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 @@ - + Introduction to Slackware -
+
Why Use Slackware? @@ -22,7 +22,7 @@ as well.
-
+
Differences Compared to Other Linux Distributions @@ -48,15 +48,15 @@ much easier to do whatever you want with your operating system. 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 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.
-
+
Licensing @@ -69,16 +69,17 @@ you different permissions regarding their use or distribution. 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 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. 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 @@ - + Basic Shell Commands @@ -15,18 +15,18 @@ probably need a little assistance in knowing how to get around, and that is what this chapter is all about. -
+
System Documentation 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 man(1). man -(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, man man will bring up the -man-page for man itself. +(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, man man +will bring up the man-page for man itself. @@ -122,7 +122,7 @@ printf (3) - formatted output conversion ls(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 / directory for your new Slackware Linux system. +the / directory for your new Slackware Linux system. darkstar:~$ ls / @@ -130,7 +130,8 @@ bin/ dev/ home/ lost+found/ mnt/ proc/ sbin/ sys/ usr/ boot/ etc/ lib/ media/ opt/ root/ srv/ tmp/ var/ -Notice that each of the listings is a directory. These are + +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 ls can do so much @@ -185,7 +186,7 @@ in chapter 5.
-
+
Moving Around the Filesystem @@ -224,7 +225,7 @@ shell for you by Slackware.)
-
+
File and Directory Creation and Deletion @@ -240,13 +241,13 @@ file, but if that file doesn't exist, it will be created. darkstar:~/foo$ ls -l --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 darkstar:~/foo$ touch bar2 --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 darkstar:~/foo$ touch bar1 --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 @@ -314,7 +315,7 @@ bar_2/
-
+
Archive and Compression @@ -361,7 +362,7 @@ archive file.
-
+
gzip @@ -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 zcat 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 for more details on output redirection). darkstar:~$ zcat /tmp/large_file.gz @@ -414,7 +415,7 @@ suggestions during this development cycle.
-
+
bzip2 @@ -429,8 +430,8 @@ typicall takes much longer to run than other alternatives.
-
-XZ / LZMA +
+XZ / LZMA The latest compression utility added to Slackware is @@ -449,7 +450,7 @@ with the -z argument, and decompression with -d.
-
+
tar @@ -555,7 +556,7 @@ compression algorithm.
-
+
Reading Documents @@ -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 more(1), named because it would let you see -"more" of the file whenever you wanted. more -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. more is also capable of -searching through a text file for keywords. Once you've displayed a -file in more, 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 -cat, but still suffers from a serious flaw: -more 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. - - - -In order to address the short-comings of -more, a new pager was developed and -ironically dubbed less(1). -less is a very powerful pager that supports -all of the functions of more while adding -lots of additional features. To begin with, -less allows you to use your arrow keys to -controll movement within the document. Due to its popularity, many -Linux distributions have begun to exclude -more in favor of -less. Slackware includes both. Moreover, -Slackware also includes a handy little pre-processor for -less called -lesspipe.sh. This allows a user to exectute -less on a number of non-text files. -lesspipe.sh will generate text output from running -a command on these files, and display it in -less. +"more" of the file whenever you wanted. +
+ more + + +more 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, or by a +specified number of lines by typing a number and then the +SPACE bar. more is also +capable of searching through a text file for keywords; once you've +displayed a file in more, 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 + cat, but still suffers from some annoying + flaws; more 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. + + + + + In fact, modern versions of more, such + as the one shipped with Slackware, do feature a + back function via the b + key. However, the function is only available when opening files + directly in more; not when a file is + piped to more. + + +
-
+
+ less + + + In order to address the short-comings of + more, a new pager was developed and + ironically dubbed less(1). + less is a very powerful pager that + supports all of the functions of more + while adding lots of additional features. To begin with, + less allows you to use your arrow keys to + control movement within the document. + + + + Due to its popularity, many Linux distributions have begun to + exclude more in favor of + less. Slackware includes both. + Moreover, Slackware also includes a handy little pre-processor for + less called + lesspipe.sh. This allows a user to exectute + less on a number of non-text files. + lesspipe.sh will generate text output from + running a command on these files, and display it in + less. + + + + Less 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 + vi-style with j and + k, or with the arrow keys, or + ENTER. 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 g key takes you to the top of + the file, while G takes you to the + end. + + + + Searching is done as with more, by typing + the / key and then your search string, but notice how the search + results are highlighted for you, and typing n will + take you to the next occurence of the result while + N takes you to the previous occurrence. + + + + Also as with more, files maybe opened + directly in less or piped to it: + + + + darkstar:~$ less + /usr/doc/less-*/README + darkstar:~$ cat + /usr/doc/less*/README + /usr/doc/util-linux*/README | less + + + + There is much more to less; from within + the application, type h for a full list of + commands. + + +
+
+ +
Linking + + symlink + + -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 ln(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 @@ - + The Bourne Again Shell -
+
What Is A Shell? @@ -26,7 +26,7 @@ users should stick to bash.
-
+
Environment Variables @@ -108,7 +108,7 @@ Password:
-
+
Wildcards @@ -171,7 +171,7 @@ it as a filename, and since that file doesn't exist,
-
+
Tab Completion @@ -188,7 +188,7 @@ matches for you.
-
+
Input and Output Redirection 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 @@ - + Printing -
+ + + 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. + + +
+ +
Setting Up a Printer in CUPS + + printers + CUPS + + -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. -
+ + The file /etc/cups/printers.conf + 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 cupsd + CUPS daemon. + -
-Commandline Print Utilities + + A typical entry would look something like this: + + + + <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> + + + + In this example, we have given the printer the name + r1060, a human-readable identifier + Ricoh 1060. + + + + The MakeModel attribute is gained from + lpinfo, 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: + + + + darkstar:~# lpinfo -m | grep 1060 + + + + This lists the drivers that you have installed, grepping for the + string 1060: + + + + 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 + + + + The MakeModel is the last half of the + appropriate result; in this case Ricoh Aficio 1060 - + CUPS+Gutenprint v5.2.6 + + + + 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 DeviceURI + lpd://192.168.4.8 because we are using the + lpd (line printer daemon) + protocol to send data to the printer. + + + + 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. + + + + In the CUPS interface, choose the Administration + tab, and choose to Add Printer. You should + be asked to enter administrative authorization here; enter + root as the admin and your root + password. + + + + 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 + LPD/LPR protocol (unless you've + managed to find a printer that requires some other protocol). + -Using the command lpr(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. -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. -
+ + 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). + + + + 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 PPD 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. + + + + The printer is now installed and will be the default printer for all + of your applications. + + +
+ +
+ Printing from the Command Line + + + Now that you have successfully installed and configured your + printer, you may also use lpr to print + from the command line. + + + + lpr sends documents to a printer but + before using it, you might want to define a default printer by + using lpadmin as root: + + + + # lpadmin -d r1060 + + + + In this example, r1060 is the human + readable name given to the printer in either + /etc/cups/printers.conf or in + the CUPS configuration. + + + + + If you do not have root privileges on the workstation you are + using, you can also set the PRINTER + environment variable: + + + + $ PRINTER=r1060 + $ export PRINTER + + + + + Once the printer has been set, then you may print: + + + + $ lpr foo.txt + + + +
-- cgit v1.2.3