13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 10 ■ THINGS GO IN, THINGS GO OUTThe utility a2ps creates nice borders and by default prints two A5 pages on A4 landscape (you canchange this with the various options). However, it doesn’t do double spacing, which makes writinguseful notes on the text difficult. The utility pr, however, does do double spacing but doesn’t do the pagestructure stuff that a2ps does.The solution is of course to stick them together:pr -d -t filename.txt | a2ps --stdin filenameThis will send output to your default printer. The -d switch does double spacing, and the -t switchsuppresses the file name and page header (which come out untidily when piping into a2ps). The --stdinswitch to a2ps then sets the page header/title as filename.■ Note If using a2ps directly (rather than piping output from pr), it will automatically set the page header/titlefrom the file name.If you want to create a PostScript file instead so that you can check the layout of the output beforeprinting it, use the -o switch to a2ps:pr -d -t filename.txt | a2ps --stdin filename -o filename.psYou can also double space text using sed:sed G filename.txt | a2ps --stdin filenameFor more information on sed, take a look at recipe 9-2.Another option is enscript, which handles both double spacing and margins, as well as font sizeand other layout options. To double space plain text with a reasonable margin, use this:enscript --word-wrap -s 16 --margins=72:72:30:30 -p out.ps foo.txt--word-wrap wraps long lines at word boundaries (rather than in the middle of a word). -s 16 setsthe baseline skip, which is the space between lines, to 16 points. The margins are set in the order left,right, top, and bottom. -p specifies the file to output to (use -P print1 to output to printer print1).enscript has the advantage as well of handling Unicode, whereas a2ps does not support it at all.10-5. Using ssh -X to Log in RemotelyThe simplest way to get graphical access to a remote <strong>Linux</strong> machine is to log in via ssh using this:ssh -X user@machine.example.com208Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!