Linux Gazette Issue No. 8

# Issue No. 8

## A Member of the Linux Documentation Project

#### "The Linux Gazette...making Linux just a little more fun...! "

##### Copyright (c) 1996 John M. Fisk fiskjm@ctrvax.vanderbilt.edu
The LINUX GAZETTE is a member of the LINUX DOCUMENTATION PROJECT.
For information regarding copying and distribution of this material see the COPYING document.

## Table of Contents

### Topics in this issue include:

- Salutations and the MailBag
- More 2 Cent Tips...
- PPPD Tips -n- Tricks, by Baard Johannessen
- The Wily Text Editor, by Gary Capell
- Monitoring a Link with SNMP, by Jason Philbrook
- Using JAVA and Netscape 2+, by Nic Tjirkalli
- Web Surfer!, by Ed Cameron
- TkDesk, FTE, Process Meters, html-helper-mode, and a Whole Lot More!, by Larry Ayers
- Shell Programming, by Geoff Taylor
- The Utility Room, by Jens Wessling
- A Collection of Articles Including:
  - An Introduction to AWK, by Cheng Hian Goh
  - Cheap ANSI Color!, by Jim Valentine
  - DIRED: Distant Relative of GNU 'ls', by Grant B. Gustafson
  - Securing your RM!, by Christophe Blaess
  - TAR'ing over the Net, by Mark A. Bentley
  - Taking Full Advantage of TCSH - precmd, by Ryan
  - Customizing Logins with XDM, by Yann Le Fablec
  - Announcing ZLISTER, by Joe Wulf
- Kernel 2.0 Upgrade, by John M. Fisk
- Colophon

## News Flash!

### Linux Gazette coming under New Management!

Yup, it's true! As of the next LG issue the Linux Gazette will officially come under the auspices of the Linux Journal . The 'ol Linux Gazette has grown over the past year -- this is actually its First Birthday this month -- and it is probably fitting that after a year it's ready to come under the watch care of the folks at Linux Journal. Phil Hughes has very graciously offered to take over the day-to-day management of the Linux Gazette while continuing its tradition as a free and freely available WWW publication.

For details of the transition, please head on down to the "Welcome" section below and read all about it. :-)

### Did you know that RedHat had a Desktop Contest?

Yup, the folks at RedHat Software, Inc., in conjunction with the folks at Digital Equipment Corp., have just finished the judging in an X Window Desktop Design Contest. The lucky winner walked home with a shiny new DEC Alpha running -- what else...? :-) -- RedHat Linux.

Stop by their Web site and have a look at what's going on there! Also, for those of you running a RedHat system and who haven't upgraded to the new 2.0 kernel... Now's your chance!! There are handy online instructions available outlining which RPM's you'll need to pick up and how to go about doing the upgrade.

### Caldera has purchase DR-DOS and is suing Microsoft Corp.!!

This isn't a joke and it's not a typo -- Caldera is going after M$.

On the 24th of July (I believe that date is correct) Caldera Corporation filed suit against Microsoft. The details are available at their web site and include a press release and details of the suit filed against Microsoft.

You need to read this thing.

As most of you know, Microsoft just finished a court battle with the U.S. Dept. of Justice over issues of anti-trust business practices. It'll be interesting to see how this current suit proceeds.

### Caldera Open Linux seeking POSIX and FIPS Certification for the Linux OS!

I recently received a message from Ian at Lasermoon regarding the proposed development of a Caldera Open Linux Group that would, as its primary goal, seek POSIX and FIPS (Federal Information Processing Standard from the National Institute of Standards, a U.S. Government Agency) certification for the Linux OS.

Here's a copy of the message Ian sent:

> Hi,

> Appended is the text of an announcement that is to be sent to the various mail lists, HowTo developers and News.

> I would be *more* than happy to write an article about this development for the Gazette if you would be interested.

> If we can assist your efforts in any way (mirroring, services etc etc) please let me know.

> Keep up the Good Work!

> Cheers,

> ----------------------------------

> Hello!

> Appended is the text of a forthcoming announcement about Open Linux - a project to push Linux through XPG4-95 and UNIX-95 branding. We are gathering opinion from the main Linux developers (such as yourself) *before* it is released to various News Groups and mailing lists.

> If you feel that you could contribute to this effort, or that what we are doing could contribute to your work, please let us know. This is the start of a huge collaborative effort which is widely seen as the way forward for UNIX.

> Open, GPL'ed Development.
> -------------------------
> This is an Open Development which will result in a Branded UNIX which will be freely distributed on the Internet in source and binary forms. We would welcome constructive comments about this development.

> If you would like to contribute to this project, we would very much like to hear from you. Please contact Ian Nandhra (ian@caldera.com) for more details.

> This is a real opportunity to change and re-define the UNIX industry.

> Enjoy!

> =========================

> Caldera is looking for people who want to enhance the Linux operating system and surrounding utilities so that they are comformant with X/Open specifications. We feel this effort provides a tremendous opportunity to help Linux grow beyond the status of "Unix Clone" to full comformance with branded UNIX. In short, Linux distributions will be able to carry the UNIX brand. This will benefit all of us as it will attract more ISVs and corporate customers, thus giving us all more application choices and a broader user base of Linux technologies.

> Caldera's open development model for Caldera Open Linux:

> - eliminates duplicate development paths
> - removes the need for multiple copies of expensive X/Open test suites
> - provides GPL source that is comformant with X/Open specifications.

>   Note: downloaded binaries and source will not carry the X/Open brand for UNIX 95 or XPG Base 95. People wanting to commercially redistribute the certified and branded kernel will be able to purchase a licence to do so from Caldera or obtain the test suites and branding directly from the Open Group.

> Caldera respects and will protect the intellectual properties of The Open Group, including the official X/Open branding test suites that Caldera recently acquired from Lasermoon of Wickham, England. Caldera will provide specs for specific technologies needed to complete the certification and branding program, partnering with others on the Internet to enhance Linux with POSIX and XPG4 capabilities.

> Engineers and others wishing to work with Caldera in creating an X/Open Branded Linux operating system should contact Caldera via email to Ian Nandhra (ian@caldera.com).

> For additional information, visit Caldera's web site (http://www.caldera.com/) or contact Caldera in the United States at (801) 229-1675.

> For additional information about The Open Group and the X/Open brand, contact Robert Noyes in the United States at (415) 323-7992 x 231 or via email at (rnoyes@xopen.org).

> Note: On May 23, 1996, at the Linux Kongress in Berlin, Germany, Caldera announced its plans to obtain POSIX and FIPS Certifications and the X/Open brand for UNIX 95 and XPG4 BASE 95 for the Linux operating system kernel. A complete news release on the topic can be viewed from Caldera's home page at http://www.caldera.com/whatsnew/open_linux.html.

> Background: Caldera is leveraging efforts originally pioneered by Lasermoon of Wickham, England, (http://www.lasermoon.co.uk). In May, 1995, Lasermoon gained membership in The Open Group (the leading consortium for the advancement of open systems) and purchased the only existing test suites for taking the Linux kernel through the X/Open branding process. Caldera now plans to add resources to this project and manage a cooperative effort among the Linux community, avoiding unnecessary duplication of efforts in the certification and branding of Linux as a full UNIX environment.

>     	--
>     Ian Nandhra                                                  ian@caldera.com
>     Caldera Inc. 633 South, 550 East,
>     Provo, Utah, USA. 84606
>     Voice : 801 229 1675         Fax : 801 229 1579       http://www.caldera.com

## Welcome to Issue #8 of the Linux Gazette !

We're One Year Old this month!

Yup, pretty amazing that the Linux Gazette is now a year old after starting life as a project to learn a bit of HTML development in my spare time. Funny how things turn out :-)

I'd like to stop at this point and offer some very heartfelt thanks to the myriad of folks who have graciously offered help and support for the Linux Gazette along the way. To the guys at Tennessee CommerceNet where the LG had its inception; RedHat Software Inc. who took the initial interest in the Gazette and provided much needed WWW and FTP support; SSC and the folks at Linux Journal who offered support and encouragement as the Linux Gazette continued to grow; to Pacific HiTech for putting the Linux Gazette on its monthly Mo' Linux CD... THANKS!!

Without all your help the LG wouldn't be possible.

Also, heartfelt kudos to the scores of folks who have written notes of encouragement, suggested ideas, offered comments and criticisms, wrote articles, provided WWW and FTP mirror sites, and took the time to drop a note just to chat about the coolest OS on the face of the earth!

Thanks!

And to all the guys who've become regulars around the 'ol Gazette -- Ed Cameron, Larry Ayers, Jesper Pedersen, Brian Freeze, Jens Wessling, & and MANY MORE...

Thanks Guys!!

And finally, I want to offer a very special note of thanks to Phil Hughes at the Linux Journal. Phil is one of those infectiously nice guys that starts a casual conversation with you and after 2 hours, you're talking and laughing like life-long buddies. He's a great guy and I'm absolutely delighted that he and the folks at the Linux Journal have been willing to take over the care and feeding of the Linux Gazette.

Here's a quick note from Phil Hughes about the upcoming transition:

> Here at SSC we have always felt that the Linux Gazette filled a niche that Linux Journal could not. Being on-line it could be more timely and address topics that would not be cost-effective in print media.

> When John Fisk mentioned that he might not be able to continue publication of the Gazette because of the time committment involved, I worked with him to make it possible for it to continue as a timely, vendor-independent source of information on Linux.

> Our plans are to continue the electronic version of the Gazette (its home is http://www.ssc.com/lg/) plus we will offer a Linux Gazette section in Linux Journal which will include the items we feel are of the most interest to LJ readers.

> Marjorie Richardson will take over the position of Editor of the Gazette. Her expericence in programming, working with Unix, and technical editing for Linux Journal and other SSC products gives her the needed background and experience to handle this assignment. If you have suggestions for the Gazette or want to make a contribution to an upcoming issue, she can be reached at gazette@ssc.com.

> Phil Hughes
> phil@ssc.com

You see, I've enjoyed working on the Linux Gazette like few things in life. This has been a HUGE amount of fun and it's brought me into contact with some of the most delightful folks in the Linux Community. It's also shown to me the tremendous spirit of community that exists among the literally world-wide group of Linux users. I've had mail from all over the US, Canada, Mexico, South America, the UK, Germany, Spain, Sweden, Finland, Czechoslovakia, Greece, Austria, Africa, the Orient, Australia, and Antarctica!

Antarctica!!

For crying out loud! There's some poor frozen guy sitting on the coldest ice slab on the face of this planet tinkering around with Linux!!

Seriously Way Too Cool...!!

Tell me that Bill G. gets mail from Antarctica telling him what a great OS he has... ;-)

Anyway, it's been HUGE.

And that brings me to why I decided to turn the Gazette over to the folks at Linux Journal.

While the LG has been a huge amount of fun this past year, it's also been a HUGE amount of work. I figure that each issue requires in the neighborhood of 20 to 30 hours of editing, proofreading, writing, reading, and tinkering to get ready for release -- and that DOES NOT include the piles of email that come in and the replies that need to be handled. Nor does it include the hours spent pouring through Usenet postings and tracking down ideas and suggestions there.

In the last issue of the LG I put out a plea for help and I was overwhelmed by the responce. Still, as I tried to get the LG organized and restructured it became more and more clear that it was starting to get out of hand. Things here in our household have been getting pretty busy as well.

So, after chatting at some length with Phil Hughes about this, I've decided to turn the Linux Gazette over to the Linux Journal. I think that the Gazette has demonstrated the "proof of concept" -- that a freely available and open-to-all online publication is a great means for sharing information and ideas. There are a number of great things that could be done with this and I'm excited about the Gazette continuing on in this tradition.

Also, please know that the Linux Gazette has been, is, and will continue to be an absolutely free publication. I can't stress this enough: I know that many folks feel passionately about keeping Linux from any commercialization whatsoever. I happen to disagree with this as it's my feeling that a free and a commercial side can peacefully coexist and actually encourage and support each other. That said, I've really enjoyed knowing that the Gazette has been freely available to all and that it will continue to be so.

So, how about that for Cool Mojo! :-)

And what will happen to Your's Truly...?

What do you think... I'm gonna disappear? :-)

No, I'm pretty excited about the prospect of starting a regular column and getting back to doing more reading, tinkering, and writing. With Phil's permission, I'd like to continue to be very much involved with the Gazette from the standpoint of supporting it and contributing to it -- and I'd strongly encourage all of you to do the same. See... the reality of it is that the folks at Linux Journal aren't going to get a red cent for doing all of this. Now, admittedly, it's good P.R. for them -- and justifiably so since they've been contributing to the Linux Community now for some time -- but that doesn't change the fact that the work has to be done.

Anyway, thanks to you all!

Looking forward to another great year!

John M. Fisk

## Salutations and the MailBag

### Mail Bag for Issue #8

Well, I'm indebted again to the many of you who took time out of busy schedules to drop a note of encouragement, thanks, correction, clarification, suggestion, or article! I had a bit of an "E-Mail Brown-out" here recently and so a number of you got replies dated weeks after you original message was sent. I apologize for this. I've tried hard to keep up with answering everyone that drops me a note. I *think* I'm back on track now...

Anyway, because it's been such a LONG time since I've gotten an issue out, and because so many of you wrote, I've moved the entire Mailbag section to its own page. This should make it a bit easier to look over.

PLEASE! Don't miss the stuff in these letters!

I'm serious. They have a LOT of great pointers, info, suggestion, tips, corrections, and the like! While you might want to check out some of the articles first, don't miss this!

Enjoy!

John

## More 2¢ Tips!

### PWD and the Prompt!

From d93002@rsl.rtc-limerick.ie Wed Jun 26 20:19:05 1996
Date: Wed, 26 Jun 1996 13:28:26 +0100
From: "Lt.Cmdr.Worf" <d93002@rsl.rtc-limerick.ie>
To: fiskjm@ctrvax.Vanderbilt.Edu

Hello,

Congratulations on your Linux Gazette, I found it to be a helluva magazine!:) Here is an interesting little trick that you can achieve in the ol' Linux, customising your shell prompt! Unwittingly I discovered ages ago, you can use escape codes to produce colors et al. The article was very recent and covered escape codes, issue 6 or 7 I think...Have you ever wondered what directory you're in and suddenly type in rm * to realise you were in a directory where there's precious backups etc..and blame yourself for not pwd'ing!!!! Fear not, this little trick will tell you what subdirectory your in each time you log in, and stays there put until you log out!!!!!!!!!

Notation: ^[[ is accomplished by hitting Ctrl+Shift+v then Esc and the key '['!
PS1='^[[s^[[0;0H^[[K^[[0;37;44mPwd:^[[1;38;40m$(pwd)^[[u\$'

In case you're wondering, this is the ANSI escape sequences to do:

> a) save the cursor position (^[[s)
> b) Goto the top of screen 0 0 (^[[0;0H)
> c) Clear the line at top of screen (^[[K)
> d) print the message Pwd in its colour, consult DOS manual on ANSI codes [0;37;44m)
> e) print the actual directory in it's colour (^[[1;38;40m$(pwd)) $(pwd) will print the directory
> f) Restore the cursor position (^[[u)
> g) Y'all should know that \$ will display $ if you're not root otherwise displays #

Hey presto, your directory is displayed on the top of the screen - pretty nifty eh! You can stick that into your /etc/profile or ~/.profile. You can customise it to display terminal type by specifying $(tty) etc..... Use your imagination. I came across something similar to that in DOS, and seems to work!!! :) :)

Cheers,
Tom Brennan.
eMail Address: d93002@rsl.rtc-limerick.ie
url: http://www.geocities.com/SiliconValley/7159
Again, I send my heartiest congrats on your magazine and keep it up,
where would us linux gurus be without you! :) :) ;)

### Prompt Clean-up!

Date: Wed, 17 Apr 1996 12:15:12 CDT
From: Edgar Greuter <edgar@inm.uni-sb.de>
To: fiskjm@ctrvax.Vanderbilt.Edu
Subject: Small Tip for the Shell-Prompt

Hi!

I have a small tip for another useful prompt modification. Even though i know about the less-program and its ability to display binary files, i often have the (bad) habit to just type a

    	more *

in the directory of a new program to get an overview of the thing. And sometimes there is this little devil ^N who puts my console in graphics mode.

This week, it happened again. Getting tired about echoing the necessary ^O to the terminal by hand, i've put it in my prompt:

    	export PS1=${PS1}^O

(as usual, ^O means control-O and is input as Ctrl-V CTRL-O in vi). Now any graphics mode is fixed at least at the next shell-prompt.

- Edgar

### Postscript Printing on Deskjets!

Date: Sun, 19 May 1996 15:33:10 CDT
From: Claudio Bardelle <clbard@mbox.vol.it>
To: fiskjm@ctrvax.Vanderbilt.Edu
Subject: My 2cent's worth

Hello John,

Thank you so much for the time you spend maintaining the Gazette. I've learned such a lot from it! Keep up your great job!

So here's my 2 cent's worth:

I was looking for a way to print Postscript files on my Deskjet using Ghostview, since I often only need to print a few pages from large documents. In other words, I was looking for something a little more flexible than using ghostscript directly. What I did was to add the following filter to /etc/printcap (filter are stored in /usr/local/lib/hp510)

    ---------------------------------------------------------
    lp|hp510:\
             :lp=/dev/lp1:\
             :sd=/usr/spool/lpd/hp510:\
             :if=/usr/local/lib/hp510/lpfilter:sh:

    ghost|hp510ghost:\
             :lp=/dev/lp1:\
             :sd=/usr/spool/lpd/hp510:\
             :if=/usr/local/lib/hp510/lpfilter-ps:sh:
    ---------------------------------------------------------

where

    lpfilter
    ---------------------------------------------------------
    #!/bin/sh
    # Filter for HP printers to treat LF as CRLF
    # the ``echo -ne'' assumes that /bin/sh is really bash
    echo -ne \\033\&k2G
    cat
    echo -ne \\f
    ---------------------------------------------------------

    lpfilter-ps (remember to chmod a+x lpfilter-ps)
    ---------------------------------------------------------
    #!/bin/sh
    # Filter for HP printers to print Postscript files
    gs -sDEVICE=djet500 -sPAPERSIZE=a4 -sOutputFile=- -q -
    ---------------------------------------------------------

I use 'lp' to print text, avoiding the 'staircase effect' (A tip I 'reaped' off one of you first lg issues), while I use 'ghost' to print Postscript files. It's also useful for printing manual pages: man -t manpage | lpr -Pghost

Regards,
Claudio

### VI paragraph formatting!

Date: Wed, 17 Apr 1996 15:22:58 CDT
From: Pat Traynor <pat@ssih.com>
To: fiskjm@ctrvax.Vanderbilt.Edu
Subject: vi justification

Here's a modification on a vi tip that was offered a few issues ago.

In my .exrc file, I have the following entry:

    	map ^P {!}fmt^M

(The "^P" and "^M" are actual control characters that I had to escape with a <ctl>-V.)

When the cursor is anywhere within a paragraph and I hit a <ctl>-P, it re-aligns all of the text. It's just the thing for those occasions when you've typed in a long paragraph and then decide to delete or add several words near the top.

I won't go into the explanation of what everything does, since that has already been done. But rather than typing

    	:10,50! fmt

which requires that you know what the first and last lines of the paragraph are, the '{' moves you to the top of the paragraph, and the trailing '}' means to do this function up to the end of this paragraph.

--pat--
--
Pat Traynor
pat@ssih.com

### There and Back!

OK, here's a fun little ditty that I recently came across that I've really fallen in love with :-) It's for all of those times that you find yourself either scooting between two directories or when you've been working in one directory, momentarily 'cd' to another, and then need to get back to wherever it was that you originally were at. (How about that for a run on sentance... :-) I'm sure that I could do better with a bit of a running start and a good tail wind...)

Anyway, I'm sure that most all of you know that the 'cd' command -- a shell builtin function -- in BASH will automagically wisk you back to your home directory if it's invoked without an argument. That is, if you simply type in:

    	% cd

at the prompt, you'll suddenly find yourself back in your home directory from anywhere in the system. So... this is a great little thing to remember for all you absentminded folks that have a tendency to wander a bit. You know... some poor freshman with a note pinned to his/her shirt: "If you find me, please return me to my $HOME: my address is 'cd'".

Anyway, for all you BASH shell users out there, here's a bit of handiness that goes a step beyond this and lets you find your way back to the directory that you previously were in.

For instance, suppose that you're tooling along on some seriously cool Tcl/Tk proggie and you realize that a bit of code from one of the demo apps might come in handy for some little problem you've been having. No problem mon... You just do the 'ol

    	% cd /usr/lib/tk

and have a look around for the code you've been looking for. OK, now you've found it and everything's groovy (I just heard on the radio the other day, BTW, that "groovy" is "cool" once again -- you know, no one is using it, so it's "hip" once again, because pretty soon everyone will be using it... I know, I know... I'm starting to ramble. Better check the note my wife pinned to my shirt this morning... :-) anyway, where were we...

Oh yeah, we had just stopped by the 'ol TK demo subdir to do a bit of GPL'd plagerism and need to get back to GO. Well, there's a VERY EASY way to do this that isn't at all intuitively obvious -- unless you've already read through all 80 pages of the BASH manual page and then if you have -- what are you doing hanging around here!!?

Well, to get back, you simply type in:

    	% cd ~-

that's a 'cd' with one of those squiggly lookin' things that lives up in the upper left hand corner of the keyboard (a tilde I believe :-) and a "dash" (or minus sign).

Do this and Presto! you're back in the 'ol neighborhood again!

Seriously Mucho Cool, eh?

Thought you'd like this one :-) And if you act now, you'll get at no extra cost a set of 8 Ginzu knives... They slice... they dice... they.... (Hmmm... I think it must be time for my medicine again :-)

Yeah, seriously, this one is pretty helpful. By now, you know all about using the 'chvt' program that comes with the 'kbd' distribution -- use this one to flit from virtual terminal to virtual terminal. Being able to do a bunch of stuff at the same time is very cool and using 'chvt' lets you keep you hands on the keyboard while you move from VT to VT. This same basic principle lets you oscillate from one directory to another as you're working. Do the 'ol "cd `-" once and you're back to the directory you started in. Do it a second time and you're back to the other directory.

Another helpful thing that you can do with this is set it up as an alias of some kind -- use any shortcut alias you'd like. Now 'cd ~-' isn't all that hard to write, but it's often easier to make up a quick alias. I use:

    	alias cdup='cd ~-'

so that I can type in 'cdup' and I'll 'cd' back up to wherever it was that I was last at.

How about that, eh?

You know, you have to admit that the Linux Gazette can never be accused to being vaporware but, truth be told, it occasionally is gaseousware I mean, where else could you find an entire two pages of verbal meanderings that boil down to, "if you type 'cd ~-' you'll change to the directory you were last in."

Think of it as getting your money's worth...

Seriously, for those of you who might be interested, this is an example of TILDE EXPANSION which is a feature of the BASH shell. Check the manual page for more info.

Enjoy! :-)

John

### HTML Clean up Macro

OK, here's another fun little item that can save you HTML authors out there a bit of time. I've been doing a bit of writing over the past year and repeatedly come back to VIM as my hands-down favorite editor for simply getting things done. It's one of those editors which, if you keep you fingers on the keyboard and not have to peek all the time or feel compelled to push a mouse or other small rodent around to get work done, let's you get things done VERY quickly. Now, you can say the same thing about Emacs I suspect, but since I'm still using 'ol VI, you're stuck having to listen to me talk about this for the moment :-)

Anyway, one of the cool things about VI is the ":so" command which basically let's you create a series of command-mode commands which you save to a text file, and then you can simply have VI "source" this in order to run the commands.

Since there's nothing like a good example to clear things up, let's see how to use this with doing a bit of pre-formatting for HTML.

As you all know, there are several characters which are not "allowed" to be directly included in the text portion of an HTML document -- these are the "reserved" characters and they include:

- the ampersand character: &
- the less-than character: <
- the greater-than character: >
- the double-quote character: "

When a browser parses the HTML document these characters are used to convey formatting or other information and so cannot be directly input.

The problem comes in when you want to include text in an HTML document. Specifically, I include a lot of email in the 'ol LG. Problem is, that much of it contains so-called "reserved characters" -- those characters enumerated above that should not be directly entered into the text. In the past I've manually searched through each letter trying to ferret these out but, as with most Linux things, there's a MUCH easier and more efficient way to do this.

As your Uncle Louigi says, "Use your head, not your back..."

So, the first thing to note is that the first step in the email->HTML conversion is converting these characters to either a "Character Reference" or an "Entity Reference" (you know -- you have to use &quot; for the (") double-quote character). You can easily do this using something like:

    	:%s/\&/\&amp;/g

This particular command does a global substitution for the current file by converting every instance of "&" to "&amp;". Do this for the other three reserved characters and you'll be on your way to dropping your email (or any other text document for that matter) into your HTML docs.

Now, you could obviously just enter these commands in by hand each time you want to do this, but hey, this is Linux and being lazy is OK -- as long as you're smart about it :-)

So, instead of typing in a set of commands to convert these characters to their Entity Reference format, we'll just set up a macro file which can be sourced for any text file. Using something like:

    %s/\&/\&amp;/g
    %s/</\&lt;/g
    %s/>/\&gt;/g
    %s/\"/\&quot;/g

will let you convert these automagically. So, how do you do this? Easy:

1. Create a plain text file and copy the above lines to it
2. Save the file with some catchy little title such as "htmlconv"
3. Load up some test document that you want to experiment on
4. Now, just issue the command ";so /path/to/file/htmlconv"

and Presto!! VI will grind away for a moment and all of the changes will be made for you.

Sourcing a macro file is one way to improve the speed and efficiency of doing things under VI(M) -- especially if you find yourself doing tasks that required frequent repetition. One small suggestion is to put these macros in their own directory off your HOME directory so that they are easily accessible from anywhere in the directory tree. To specify such a macro you could enter:

    	:so ~/macros/htmlconv

and the tilde (~) would be automagically expanded out to point to your home directory.

Anyway, this is one of those "tip of the iceburg" types of things because there is a HUGE amount of mischief you can get into using macros :-)

Have fun!

John

### Getting Rid of ^M's

OK, I *promise* to keep this one nice and short.

If you use Linux long enough you'll eventually find yourself with an annoying case of "^M" infestation in some file you've just created or are working on. For my Comp Sci classes this past year I was required to do a "script" output for each of my progamming projects: start the 'script' program, 'cat' the source file, compile it, and then run it. This created a log file which had to be turned in. One of the most annoying things about doing this was, at least on my Linux box, that it was replete with "^M" at the end of each line. You'll also find that occasional DOS files will have these scattered all throughout them as well.

So, how do you get rid of them without resorting to an exterminator...?!

Glad you asked :-)

A while ago, there was a thread in one of the comp.os.linux.xxxxx gruops about this very subject. I'd discovered how to get rid of the ^M's easily from within VIM but a number of other of suggestions were made as well and so I'll present these. I apologize to their original authors. I wrote the ideas down but neglected to write down who offered them. If you recognize any of these as "your's" then please drop me a note and I'll be glad to give credit where credit is due.

Anyway, here's how:

From within VIM use the command :%s/^V-RETURN//g
  You'll need to get out of edit mode to do this one (hit ESC). Enter a colon, percent sign, the letter 's', and a forward slash. Now, you'll need to use the Ctrl-V key combination to enter a literal key: hit the control and 'v' key together and then hit the ENTER (or RETURN) button which should display a '^M'. Now, hit two more forward slashes and the letter 'g'. Hit ENTER and you're done!

  What this does is a global substitution through the entire file. Each occurrence of the ^M (which is a "carriage return" -- remember that UNIX uses only the line feed (LF) character to start a new line whereas DOS uses the carriage return + line feed characters (CR + LF) to start a new line) is substituted by, well, nothing. So this effectively erases each occurrence of the ^M.

At the command line use sed
  You can use 'sed' (the Stream Editor) to trim out those unwanted ^M's in a couple different ways:

      	% sed 's/^M//' < ORIG.FILE > new.file
      	-OR-
      	% sed 's/.$//' < ORIG.FILE > new.file

  Just a couple points here...

  For the first example the "orig.file" is the file that you wish to remove the ^M's from and the "new.file" is what you want to call the edited file. Don't use the same filename! If you do, you'll be sorry as the contents of your original file will be deleted by doing this. Caveat Emptor!

  Also, the "^M" is the same control-v + RETURN combination mentioned above. The standard UNIX editors VI and Emacs both let you insert characters literally (this let's you insert characters such as the Escape key that are normally non-printing keys). The Bourne shells tend to use VI keymappings and the C-shells tend to use Emacs binding. Thus, if you're using BASH you'll use control-v to insert a literal character at the command line and then hit ENTER (or RETURN) to insert a literal carriage return character.

  The second example doesn't use any of this type of literal character stuff -- just type it in as you see it and it'll work!

Pipe the file through tr
  You can use the 'tr' (translate) utility to accomplish the same basic thing by doing something like:

      	cat orig.file | tr -d \\r > new.file

  Again, there's no tricky literal character input here; you just type it in as listed above. Do note, however, that you pipe the output of the 'cat' operation to 'tr' and then redirect the output from 'tr' to the new file you wish to create. And don't forget to use a different name for the new file!

Well, hopefully, that should get you going!

Enjoy.

John

## PPPD Tips -n- Tricks

### http://www.colargol.idb.hist.no/~bardj/lg/pluggin1.html

by Baard Johannessen <bardj@utopia.ppp.sn.no>

After a request for help in the last LG a number of folks wrote and offered to help, including Baard Johannessen who offered to write an article on using PPP including all the fun things that you can do with it! His URL is listed above and the letter he sent describing it is included below.

Thanks Baard!

> Date: Wed, 17 Apr 1996 23:12:43 CDT
> From: Baard Johannessen <bardj@colargol.idb.hist.no>
> To: fiskjm@ctrvax.Vanderbilt.Edu
> Subject: Writing for the Linux Gazette

> Hello!

> I am writing to you today in response to your request for help with the Linux Gazette.

> I feel that if there is one area where Linux proves it's strength it is when connecting a PC to a TCP/IP network. Seeing as more an more people get access to PPP dialup accounts, I think it would be nice with a column about all the things you could do using such a connection. The thing is: If you got a PPP connection to the Internet, you got your own IP address, you can actually do anything anyone else does.

> I have a Linux machine connected to our company LAN. On it's responsible for retrieving our eMail, it runs a Web server and FTP server. It runs a news server for our LAN, downloading a selected set of newsgroups whenever it goes online. It's got sendmail configured (like you described in a previous issue of LG) to queue remote mail, while delivering local mail immediately. It also function as our Internet gateway, by using something called IPMasquerade. This enables all the machines on our LAN to access the Internet through this machine, and without the cooperation of our ISP (saves us equivalent of hundreds, if not thousands of dollars).

> Such a column would start with the basics of setting up PPP, sendmail, popclient and things like that. Then we could move to other interesting things like setting up a news server, a Web server and a FTP server. Obviously some security stuff would also be needed.

> If you thing a column like this would be a good idea, please feel free to get back to me.

> It's not like I don't have enough to do, but I spend quite a lot of time with Linux already, and a project like this would be a great way for me to document some of the thing I do. I will start setting up a similar system for a client shortly, so I could probably take a lot of this stuff from my notes on that system.

> I have the ability to produce on a regular basis (once a month, wasn't it? :), and the time to receive and READ any eMail it my writing generates. I'm also quite capable of writing HTML.

> Anyway, you probably get a lot of eMail, so I think it's time for me to shut up, and await your reply.

>                                          ,,,
>                                         (o o)
>     ================================oOO==(_)==OOo=================================
>                 Baard Johannessen                     Phone   : (+ 47) 33 13 00 93
>            bardj@colargol.idb.hist.no                 Private : (+ 47) 94 41 27 47
>      http://www.colargol.idb.hist.no/~bardj/          Fax     : (+ 47) 33 13 03 13
>                                     .oooO  Oooo.      Cell    : (+ 47) 90 82 79 66
>     ================================(   )==(   )==================================
>                                      \ (    ) /
>                                       \_)  (_/

> Date: Thu, 11 Jul 1996 06:52:07 +0100
> From: Baard Johannessen <bardj@utopia.ppp.sn.no>
> Reply-To: bardj@colargol.idb.hist.no
> To: fiskjm@ctrvax.Vanderbilt.Edu
> Subject: Re: Column for the LG

> Just writing to remind you I allready have done the first column. You have seen it, but seeing how things have "gotten a LOT more out of hand than you had anticipated" I thought I'd remind you :)

> Look it up at: http://www.colargol.idb.hist.no/~bardj/lg/pluggin1.html

> Regards
> bardj (looking forward to the next issue)

## The Wily Text Editor

### http://www.cs.su.oz.au/~gary/wily/

by Gary Capell <gary@cs.su.oz.au>

Here's a review of the Wily Text Editor which is fashioned after Plan 9's Acme Text Editor. Take a look and see what you think!

> Date: Mon, 10 Jun 1996 18:02:05 CDT
> From: Gary Capell <gary@cs.su.oz.au>
> To: fiskjm@ctrvax.Vanderbilt.Edu
> Subject: possible addition to "Editors" section of linux_toys

> http://www.cs.su.oz.au/~gary/wily/

> Let me know what you think?
> --
> http://www.cs.su.oz.au/~gary/

## Monitoring a Link with SNMP

### http://www.midcoast.com/~jp/snmp.html

by Jason Philbrook <jp@midcoast.com>

Here's an article about...

> Date: Tue, 14 May 1996 20:47:50 CDT
> From: jason philbrook <jp@midcoast.com>
> To: fiskjm@ctrvax.Vanderbilt.Edu
> Subject: linux gazette

> If you're looking for material for the linux gazette, consider a page I made explaining SNMP and a bit of simple shell scripts.

> http://www.midcoast.com/~jp/snmp.html

> -Jason Philbrook

## Using JAVA and Netscape 2+

### Using The JAVA Compiler In Netscape 2+ To Compile JAVA Classes

by Nic Tjirkalli <nic@pipex-sa.net>

The Java Development Kit (JDK), ported to Linux by the kind folks at Blackdown, allows Linux users to compile java source code to produce java class files. However, the JDK requires a Linux ELF system and will not work on an a.out system. The Netscape Navigator (version 2.0 and higher) contains a java compiler which can be used to compile java source code on a.out and ELF Linux systems.

### REQUIREMENTS

You will need the following bits of software :-

1. The Netscape Navigator For Linux.

   This is available at Netscapes's site or from one of its numerous mirror sites. INSTALL netscape as per the instructions in the readme.

2. The classes.zip File From The JDK

   You will need to pull down part of the Linux JDK port and extract the classes.zip file. Proceed as follows :-

   - Pull down part of the Linux JDK port from the Blackdown FTP site.

   - Extract the classes.zip file as follows :-

         tar -zxvf linux.jdk-1.0-try1.common.tar.gz java/lib/classes.zip

     This will extract the file classes.zip and palce it in the java/lib idirectory, off the current directory.

   - Move the classes.zip file to the same directory where the Netscape moz2_0.zip is located. I use :-
     /usr/local/netscape/java/classes
     with the following command :-

         mv java/lib/classes.zip /usr/local/netscape/java/classes/.

   - You may now delete the JDK gzipped tar archive file :-

         rm linux.jdk-1.0-try1.common.tar.gz

3. My javacc script

   I have called the script javacc so as not to confuse it with the java compilere, javac which is available in the JDK. Place the script whereever you want and change its permissions to make it executable, as follows :-

       chmod 555 javacc

   Basically, the script checks that a java source code file name (complete with its extension, normally .java) has been entered and that the file exists before calling the java compiler.

   Also, the script sets up the environment variable CLASSPATH to point to the java class library include with netscape (this is the file moz2_0.zip for Netscape 2.0x and moz3_0.zip for Netscape Atlas) and the classes.zip file from the JDK.

    # --------------------------- javacc script begins here ----------------
    #
    # javacc
    # Script To Use The Built In Netscape Java Compiler To Build Java Classes
    # Nic Tjirkalli, April 1996 nic@pipex-sa.net
    #
    #
    # Usage : javacc file.java
    #
    # NOTE : CLASSPATH must point to the files
    # moz2_0.zip i(or moz3_0.zip if you are using Netscape Atlas
    # and classes.zip (from the JDK)
    #
    # If your are using Netscape Atlas preview, the netscape classes
    # file is called moz3_0.zip. Modify the CLASSPATH to point to
    # this file instead of moz2_0.zip.
    #
    # NO WARRENTY IS PROVIDED WITH THIS SCRIPT - IT IS USED AS IS !!
    # YOU MAY FREELY USE AND DISTRIBUTE THIS SCRIPT
    #
    #!/bin/bash
    #
    if [ $# -eq 0 ]
       then
            echo "   No JAVA file specified"
    	echo "   javacc USAGE :- javacc java-source-code-file.java"
       exit
    fi

    if [ $# -gt 1 ]
       then
    	echo "   Too Many parameters - ignoring all but the FIRST"
    fi

    if [ -f $1 ]
        then
    	echo  "      Compiling -> " $1
    #
    # If you are Using Netscape Atlas, change moz2_0.zip to moz3_0.zip
    # in the CLASSPATH environment variable
    #
    export CLASSPATH=.:/usr/local/netscape/java/classes/moz2_0.zip:\
    /usr/local/netscape/java/classes/classes.zip
    #
    # If your netscape binary is not in /usr/X11/bin, modify the path below
    #
    	/usr/X11/bin/netscape -java sun.tools.javac.Main $1
    	echo "Done"
        else
    	echo "   JAVA file not found !! bummer......"
    fi

    #
    # --------------------------- javacc script begins here ----------------
    #

### USAGE

To use the javacc script, invoke it as follows :-

javacc java-source-file.java

USAGE NOTES:

1. The script checks to see if a source file parameter has been entered. If no parameter is specified, the script comes up with a usage message.
2. If multiple command line parameters are entered, the script only uses the first parameter as the java source code file name and ignores all other parameters

If the java compilation is successful, a java bytecode file, with the extension .class is created. This is the java applet.

### SOME INTERESTING JAVA RELATED SITES TO VISIT

http://studwww.rug.ac.be/~vwillems/JAVA

http://www.nebulex.com/URN

http://www.gamelan.com

Nic Tjirkalli

## Web Surfer!

### This Month's Web Surfer!

by Ed Cameron <ecame119@ecity.net>

Once again, if you're up to doing a bit of Web Surfin' then have a peek at all the of seriously fun place to have a look at. This month's WS includes a look at TkNet, some pretty funky lookin' stuff from Sega, Lions, Tigers, and Bears! (...Oh My!), and other nifty ramblings.

Thanks Ed!

Enjoy!

## TkDesk, FTE, Process Meters, html-helper-mode, and a Whole Lot More!

### New Releases & Revisions

### Introduction to TkDesk

### VM- & Html-Helper-Mode for Emacs

by Larry Ayers <layers@vax2.rain.gen.mo.us>

Well, once again I owe a HUGE debt of thanks to Larry Ayers for his absolutely wonderful and prolific reviews of a LOT of great software. His first document on New Releases and Revisions includes reviews of:

- An Nedit that works
- ELF-based Andrew User Interface System (AUIS)
- FTE: A Folding Editor from the OS/2 World
- TkEdit: An Editor Worth Investigating
- A Couple New Process Meters

His next review takes a look at an impressive Tcl/Tk based desktop management utility: TkDesk. And finally, there's a review of the VM- and html-help-modes available for Emacs.

These are GREAT reviews. There are some very nice descriptions and screen shots for several programs. Drop Larry a note (and for that matter, drop any and all of the contributing authors a note!) of thanks for this!

## Shell Programming

by Geoff Taylor <geoff@marburg.dnet.co.uk>

I've said this before but it certainly bears repeating: "99% of all Linux users are their own system administrators and every system administrator needs to know how to shell program!"

In view of this, I'm very pleased to include this great shell programming article by Geoff Taylor. In this article he'll take you through the writing of a couple pretty useful shell programs: px and search.

I REALLY appreciate Geoff's contribution. There's a HUGE amount of fun and useful things that can be done with a little bit of shell know-how and I'd welcome any other such submissions!

Thanks and enjoy!

## The Utility Room!

by Jens Wessling <wessling@famine.emich.edu>

Here's an offering of even MORE great tips for using one of my admittedly favorite programs - VI :-)

## A Collection of Articles

### Linux Gazette #8 Articles

One of the things that I've been truly amazed by over and over again is the tremendous sense of generosity and esprit de corps that exists within the Linux Community. A number of you have written and sent in articles for the Linux Gazette. While I appreciate articles that come "pre-tagged" for HTML, I also appreciate anyone's willingness to write and share their ideas.

This collection of articles are those that I tagged up -- because time has been such an exasperating problem recently I took the liberty of collecting these altogether and including them in a single file (I'm afraid it isn't quite as fancy as those many of you have sent in).

These are some excellent articles and I'd encourage you all to at least skim though these as they touch on a number of very practical subjects. So that you have an idea about what is included, here's the TOC so that you can jump right to an article that sounds interesting to you:

### Table of Contents -- Linux Gazette #8 Articles

- An Introduction to AWK, by Cheng Hian Goh
- Cheap ANSI Color!, by Jim Valentine
- DIRED: Distant Relative of GNU 'ls', by Grant B. Gustafson
- Securing your RM!, by Christophe Blaess
- TAR'ing over the Net, by Mark A. Bentley
- Taking Full Advantage of TCSH - precmd, by Ryan
- Customizing Logins with XDM, by Yann Le Fablec
- Announcing ZLISTER, by Joe Wulf

Enjoy!

## Kernel 2.0 Upgrade

### Experiences with Kernel 2.0 Upgrade

by John M. Fisk <fiskjm@ctrvax.vanderbilt.edu>

Well, I have to admit that I've been a bit of a "stick-in-the-mud" until recently when comes to kernels. I'd been stubbornly running kernel 1.2.13 for months while the rest of you "Bleeding Edge" kinda folks gradually ascended higher and higher into the 1.3.x kernels :-)

Since I use Linux for my Internet connection and do all of my HTML development under it I really wanted stability. However, once the 2.0 kernel came out and Michael K. Johnson's article in the Linux Journal provided a concise summary of the improvements from the 1.2.x -> 2.0.x kernels, I decided to take the plunge.

Well, I did it and I'm pretty happy about it! :-)

It's not as bad as it sounds and it really is worth the effort. What I'd like to do is share with you about how this upgrade went for me. Your experiences will probably be different depending on the hardware that you're running, which distribution you're using, and so forth.

Still, I really believe that it's worth the effort!

I'd be delighted to hear from any of you who've done that same thing. Drop me a note and let me know how things went for you!

Hope you enjoy.

John

## Of Keys, Consoles, & VT Cruisin'

### Keyboards & Consoles

by John M. Fisk <fiskjm@ctrvax.vanderbilt.edu>

I recently submitted an article to the Linux Journal for the Novice to Novice column. I really appreciate the generosity of the folks at the LJ and, with their permission, have included the draft of this article here.

This particular article contains mostly stuff that I or someone else has written about before in the LG, but for those of you who may be visiting and who haven't seen those articles, here's a bit of information on keyboard mapping, switching virtual terminals (VT's), and other fun stuff.

Hope you Enjoy!

John

## Colophon

Well, I think we're almost ready to go. It's funny... I've mentioned this before but I really enjoy writing this section of the LG. I purposely wait to write this last and, kind of like coming home after a busy day, it's nice to kick back and just chat.

As I mentioned before, I can't tell you how pleased, relieved, and excited I am about turning the LG over to Linux Journal. I think that this will be a Very Good Thing primarily because it deals with one of the things that frustrated me more than anything else -- not being able to get the Gazette out on a regular and timely fashion. I am really excited about the Gazette being published in a more predictable fashion as I know that many of you wrote about this.

Also, since I haven't had much time to do any serious 'Net cruisin' recently let me share with you, if you don't mind, a project that I started tinkering around with a while ago. One of the things that I was hoping to do over the summer was learn a bit of Tcl/Tk programming. While I haven't had nearly the amount of free time to do this as I'd hoped, I still found a bit of time earlier this summer to play around with an X Window interface for pppd.

I have to admit, Tcl/Tk is just too much fun! Now, I'm not sure that I'd want to be building Lotus Smart Suite or Microsoft Office in Tcl/Tk, but for small project and programs this is just too much fun. What I wanted to do was to create a front end for pppd that I could use either as 'root' or as a user. I also wanted it to have a few little "extras" such as a timer, line selection, and logging facility. Well, it turned into a LOT of fun and after a bit of tinkering and pouring over John Ousterhout's and Brent Welch's books on Tcl/Tk programming, I finally got an admittedly alpha version up and running.

For the curious, here's a miniature screen dump:

Hmmm... looks a bit fuzzy, eh? Well, if you're interested, here's a full screen view of the program together with a brief description of what it does.

Now, I admit that I'm no serious Tcl/Tk programmer, but I've been REALLY impressed with how well this little program works and how easy it's been to modify it. For anyone interested, I'd be happy to send you a copy of the sources with the proviso that you understand that this is NOT a general pppd utility -- there are MUCH nicer and easier programs alreay available including Tk-Net and tkppp. If you're looking for an easy to use X front end, I'd give Tk-Net a look at. And, you're in luck, because Ed Cameron has included a section on this very program (with some nice screen dumps) in this month's Web Surfer!

Well, I've still got a bit of work to do to get the LG files ready to go. So, it's time to "Say Goodnight, Gracie!"

Again, thanks to all for your kind support and for making the Linux Gazette just a bit more fun...!

Cheers!

John M. Fisk
July 30, 1996

#### Got any great ideas for improvements! Send your comments, criticisms, suggestions, and ideas.

### Back up to Linux HomeBoy WebPage

This page written and maintained by: