# More 2 Cent Tips & Tricks LG #65

# More 2¢ Tips!

Send Linux Tips and Tricks to gazette@ssc.com

- Re: Graphics Programming for Printing / Faxing (Issue 60)
- Alliance Pro-Motion driver
- How to avoid launching Midnight Commander by accident
- Gazette, I.55, Answer: Missing Root Password
- SNMP Tool for networking (re: March tips)
- distro version upgrade? (slackware)
- 2-cent Tip: Cleaning up after Netscape
- Regarding backups [issue64 tag/28.html]
- Modules cannot load with kernel recompile
- RE: Linux PPP route question
- "Interrupt for Linux" question from S. Auejai
- 2ct tip - Removing temp files
- Linux RedHat question
- Question on stty
- inode related question
- HELLO --or--
  Protecting web pages
- SSH article
- Linux commands
- How write a selfextracting sh script ?
- Searching for a text revisioning tool
- 2.4.2 and loop devices
- Re your Fortran answer (tag 15, iss 64)
- Agenda Computing Challenges Palm
- Mailbag #62; Memory mystery
- mcad

### Re: Graphics Programming for Printing / Faxing (Issue 60)

Tue, 27 Feb 2001 16:32:59 -0800
Anthony Greene (The Answer Gang)

Re: Graphics Programming for Printing `/` Faxing (Issue 60)

The quick and easy way for a Perl programmer to do convert data to faxable invoices/reports is to output the data as HTML, convert it to Postscript using html2ps <http://www.tdb.uu.se/~jan/html2ps.html>, then fax the result using `efax` or `mgetty+sendfax`.

### Alliance Pro-Motion driver

Sun, 25 May 1997 23:23:08 -0400
Ralph E Bugg (buggr from sssnet.com )

There was a letter to you from an unidentified person looking for a driver for an Alliance Pro-Motion video card.

"....Anyways, I would just run Linux but my problem is that Xwindows doesn't have advanced support for my video card, so the best I can get is 640x480x16colors and I just can't deal with that. Maybe I'm spoiled. The guy I wrote on the Xwin development team told me that they were working on better support for my card, though. (Aliance Pro-Motion). ...."

If he goes to http://www.alsc.com and follows the path to tech support, he will find a SVGA driver (no source code though) for X-windows. I am using an NEC Ready 9618 system which uses one of the Alliance chips on the mother board. It took a LOT of fiddling with the configuration file but it will work at higher resolutions @ 256 colors.

Hope you can pass this on to him.

Thanks, Ralph Bugg.

### How to avoid launching Midnight Commander by accident

Mon, 26 Feb 2001 10:31:51 -0500
Allan Peda (apeda from linkshare.com)

I've typed "mc foo bar" one time too many when I really meant to type "mv foo bar". Removing Midnight commander is not an option, because that breaks some file exploror type GUI utilities, so I cooked up a bash script to double confirn that I wanted to type what I (probably mis-)typed :

See attached script mc.bash.txt

### Gazette, I.55, Answer: Missing Root Password

Wed, 28 Feb 2001 17:23:18 +0100 (CET)
Johannes Kaiser (uehj from rz.uni-karlsruhe.de)

It should be easy to get in if you use LILO. At the boot prompt, type in the name of your boot image (you can find that out by hitting the "tab" key twice), followed by the word single. For a normal redhat installation, typing "linux single" should do. You also can append "init=/bin/sh" instead of "single", that leaves remounting your root filesystem rw to you.

### SNMP Tool for networking (re: March tips)

Thu, 1 Mar 2001 17:02:10 +0100
Casas Bouza, Robert (robert.casas from puig.es)

Hi!

About the question done by Antonio Sidona (looking for a SNMP tool for networking, tips) on you March 2001 issue, we have tried netsaint (www.netsaint.org). It's a great tool, although needs to be configured properly, but you can monitor any system that support SNMP or not. A funny thing is that we HAVE HP OpenView installed, but you need license per console, and NetSaint can be installed on a Web Server and accessed through a browser. We actually used them on a complementary basis.

Robert Casas

### distro version upgrade? (slackware)

Thu, 01 Mar 2001 13:45:43 -0800
Michael Moore (michael_moore from csnw.com )

Dan Blazek wrote:

Hi, I think I'm running Slackware 2.2 (kernel is 2.0.27 for sure anyway). Is there some kind of cluster or patch bundle I can download to upgrade my box. Like a single package I can install to at least jump up to slackware 3? And if there is.. can you please tell me where to find it, and if there is there a special way to install it? Or am I going to be stuck installing a new image?

Heather wrote:

> I thought there wasn't one, but rarely say so without looking. And what do you know, I found:

> slackUp - The Slackware Auto-Upgrade Utility
>   http://xfactor.itec.yorku.ca/~xconsole/download.html

> You should read its readme yourself, to check that it can handle your version. If it can't. get involved with the authors ... they haven't updated it in almost a year (or at least the webpage) and you may spark an entirely new round of development for the project.

David Cantrell, one of the Slackware staff members, has also made a pretty comprehensive Slackware upgrade utility, autoslack. While this is not a supported Slackware project, David's involvement probably means it is likely to work well with their site. You can find it on their unsupported projects server at http://zuul.slackware.com

-Michael

### 2-cent Tip: Cleaning up after Netscape

Thu, 1 Mar 2001 17:51:39 -0500
Ben Okopnik (The Answer Gang)

Linux is a wonderfully reliable OS: even the software that runs under it is reliable. X Windows runs reliably. Midnight Commander is reliable. Even Netscape Communicator crashes reliably.

Ooops...

Netscape is a nice piece of software, in that it supports everything (and then some) that a modern "fancy" browser should support. Unfortunately, the rate at which it goes down brings to mind expressions about hookers on payday - and in my experience, it's been this way from day one. Not only that, it tends to leave behind hung copies of itself (which makes the processor load shoot right up into the red) and lockfiles that create error messages the next time you try to start it up.

A few months ago, tired of having to clean up the random garbage, I created this script. If Netscape has crashed, or is simply frozen, it will take care of everything. Nowadays, it's my automatic response to a Netscape crash. <sigh> I'm getting awfully familiar with typing "notscape"...

See attached script notscape.bash.txt

### Regarding backups [http://www.linuxgazette.com/issue64/tag/28.html]

Thu, 1 Mar 2001 19:02:35 -0500
David Jao (scythe from dominia.org)

Hi guys,

This is in response to Bruce Harada's message at

http://www.linuxgazette.com/issue64/tag/28.html

I would have preferred to contact him directly but I could not find an email address for him on the page.

Using gzip on backup files 2GB in size is a really bad idea, since if the compressed file gets corrupted at any point, then everything occuring after the point of corruption will be unrecoverable.

Of course if hard drives are perfectly reliable then corruption is no problem, but if that were the case then you wouldn't be doing backups anyway.

In general, compressing large backups is almost never worth it because of the reliability issues. If one must use compression, bzip2 is a better choice, since it uses 900kB blocks and corruption would only affect an individual data block.

-David

### Modules cannot load with kernel recompile

Thu, 01 Mar 2001 22:39:33 -0500
Tom Walsh (tom from cyberiansoftware.com)

Regarding 'http://www.linuxgazette.com/issue64/tag/16.html', I use 'make install' myself, saves you the step of copying the image to `/boot` and forgetting to run lilo.

-- Tom Walsh

### RE: Linux PPP route question

Fri, 02 Mar 2001 14:06:07 -0600
Brian Finn (nacmsw from airmail.net)

Hi,

I found a dial-on-demand package for Linux called Diald. I think it may help alleviate your PPP problems. You can find it at:

> http://diald.sourceforge.net

Hope this helps!
Brian Finn

### "Interrupt for Linux" question from S. Auejai

Mon, 05 Mar 2001 12:09:38 -0600
Bill McConnaughey (mcconnau from biochem.wustl.edu)

I found Alessandro Rubini's book, Linux Device Drivers, published by O'Reilly and Associates, very helpful in getting started on writing device drivers (including interrupt handlers).

### 2ct tip - Removing temp files

Tue, 06 Mar 2001 20:58:25 -0800
forsberg (forsberg from adnc.com)

When writing a program that uses temporary files on a UNIX/Linux system it is convenient to use a feature of UNIX. Create the temporary file, then remove it (i.e. `unlink()` ) without closing the file.

    fd = fopen("/tmp/somefilename.tmp",...);
    unlink("/tmp/somefilename.tmp");
    .
    . Use temp file
    .
    fclose(fd) or exit();

Then you can read and write to this file during the existance of this process. The temp file will not be removed until a close statement on the file descriptor or the program terminates. Only then will the kernel remove the file. Use this technique to guarantee that all temp files are cleaned up if your program crashes.

Bruce Forsberg

### Linux RedHat question

Wed, 28 Mar 2001 12:18:34 -0800
Ray Hanes (high_tech_hanes from yahoo.com)

I saw your page and don't know if your still actively maintaining it and answering questions but in case you are. I'm trying to find a variable for what version of Red Hat is running. If there is no variable for it from the system then how can I get a script file to detect the Distribution Verson assign it to a variable?

Hi Ray --

On a default RedHat install, the file `/etc/redhat-release` contains the version. Most RedHat installs leave that file there. (I always delete it because the existence of that file causes the rc.local script to overwrite `/etc/issue` at bootup.)

Hope this helps -
--
Breen Mullins

### Question on stty

Tue, 20 Mar 2001 11:46:06 -0800
Iris Louie (IHo from altera.com)

I have to type in stty erase "backspace" each time I log in. How can I get set it as apart of the default stty setting?

Put the command in your ~/.bashrc file or whatever file your shell reads at startup. -- Mike

### inode related question

Fri, 16 Mar 2001 09:57:20 -0800
HCL Amritsar (narenderpk from usa.net, tag from ssc.com)

in unix file system if inode of current directory is known .explain how to find the inode of the file `../file1.`

    $ ls -i ../joey/.bashrc
     407098 ../joey/.bashrc

-- Mike

### Protecting web pages

Mon, 26 Mar 2001 10:05:00 -0800
Doranda L Martin (anonymous)

Hello,
my name is D and i have a web page. I have a question. I would like to know how to put an entry box in my web page. Actually i am trying to hav it so that you must have a password to get to certain parts of my web page, basically the table where my poems are and then have a way to make them have to enter a password to look at the poems if someone accidentally got to the table. i would like:

> box 1: their email address
> box 2: password
> submit

please help, if you could send me codes or somewhere to go or anything it would be a great help

If your web server is Apache and it has been configured to support (1) HTTP Basic Authentication, and (2) .htaccess files, do the following:

1. Use the htpasswd program to create a password file. (This is not the UNIX password file; for security, you should use different passwords than your login passwords.)
2. Create a file called .htaccess in the highest-level directory you wish to protect. The file should contain:

>     AuthName "Poems"
>     AuthType Basic
>     AuthUserFile /path/to/htpasswd/file
>     require valid-user

Now, when the user tries to access anything in or under that directory, the browser will prompt her to type her "Poems" username/password. If she does not type it correctly, she'll get an "Unauthorized" error.

Your Apache configuration file must "AllowOverride AuthConfig" for either the entire site or the portion of the site you're concerned about.

See the Apache documentation: http://httpd.apache.org/docs/mod/mod_auth.html and http://httpd.apache.org/docs/mod/core.html#allowoverride
-- Mike

### SSH article

Tue, 6 Mar 2001 14:55:51 -0800
Bryan Henderson (bryanh from giraffe-data.com)

In the article on ssh, scp, and sftp in the March issue, there is an important area that isn't covered: client/server compatibility.

If you're just doing a basic ssh (to get a remote shell), you're using a standard SSH protocol and any program named "ssh" is likely to work with any remote system that offers a service it calls "ssh."

But scp and sftp are not standard protocols. If you run the scp program from openssh against a remote system that's running an original ssh server, it will not work. (And when I learned this the hard way, it was very hard indeed: the error message isn't "this server doesn't implement this scp protocol." It is, for reasons that took a day of debugging to figure out, "invalid file descriptor"!

-- Bryan Henderson

This was also forwarded along to the author of that article for comment, but we got no reply by press time. -- Heather

### Linux commands

Wed, 14 Mar 2001 09:13:48 -0500
katja.andren (katja.andren from spray.se)

Hi!

I'm new Linuxuser (Redhat ver.) and I'm loking for a summery of commands, "Linux version of DOS-commands". Do you have any good tips on where I can find it?

As it happens, such a thing exists. The summary, as well as a lot of other useful tips for those who are used to DOS or Windows, are all included in the DOS-Win-to-Linux-HOWTO. Take a look at "`/usr/doc/HOWTO`" (if you have them installed on your system - if you don't, you should!), or <http://www.linuxdoc.org>; for the latest version. -- Ben

### How write a selfextracting sh script ?

Thu, 15 Mar 2001 07:35:49 +0100
Josep Torra Valles (jtorra from campus.uoc.es)

I would like to know how write a selfextracting sh script with a tar.gz(source code of my program) to be installed, and after it's extraction I need run make in order to compile and finish the installation.

Thanks in advance

Strange as this may sound, about a year ago, I wrote a shell script that does exactly that - including automatically running "make" or another program to process the files. I even packaged it as a tarball, with documentation, configuration files, and even a man page... but I never released it. Why? <shrug> There are a lot of tangled issues, including the fact that this mechanism can be easily misused for malicious purposes. On the other hand, so can anything that you download off the Web and execute without checking it out first. Whatever, your e-mail here has spurred me to go ahead and make it public: you can download "SFX" from my site, as <http://www.geocities.com/ben-fuzzybear/sfx-0.9.4.tgz>;. If you run it without any options, it'll tell you how to create files that will self-extract and compile, all in one shot. I also took some trouble with the documentation; the "method" files are a pretty cool way to specify action after extraction, and you can always create your own.

I'd really appreciate feedback from anyone who ends up using SFX; if there's enough interest, I'll rewrite it, possibly in C or Perl.

### Searching for a text revisioning tool

Sun, Mar 11, 2001 04:48:16PM +0100
Peter Paluch (peterp from frcatel.fri.utc.sk)

Hi,
=-=

I often do revisions and checks of articles and text documents that my colleagues wrote, and under Linux I miss the ability of MS Word97 and above which allowed me to do revisions very conveniently. Under "revisioning" I understand writing several marks and suggestions for the author to the revisioned document, striking-out whole words or sentences and replacing them with new ones.

I'm thus searching for a Linux document revisioning tool. It would be lovely if the tool worked with XML. Do you know anything that could help me? (Please notice that CVS is not what I need.)

Thanks a lot in forward.

Have you taken a look at WordPerfect 8 for Linux? I don't have it installed on my current machine, but I seem to remember seeing some kind of revision-type stuff in the menus. -- Ben

### 2.4.2 and loop devices

Tue, 13 Mar 2001 22:42:11 -0800
David Ellement (david.ellement from home.com)

I've recently compiled the 2.4.2 kernel (under RH 7.0). It seems I can no longer run any commands the interact with the block loop devices: mkbootdisk, mkinitrd, mke2fs `/dev/loop*`, mount -o, ... If I run one of them, they hang at mke2fs `/dev/loop;` if I try to halt the system afterward, it hangs trying to shutdown the file-systems.

I've tried to compile with loop device support as a built-in, and as a module (and lsmod show it loaded). What am I missing?

... but he managed to discover for himself ...

The 2.4.2 kernel has a bug which caused a deadlock for loop devices. It is fixed in the 2.4.3-pre2 and later patches.

Thanks for passing us the Tip, David! -- Heather

### Re your Fortran answer (tag 15, iss 64)

Tue, 13 Mar 2001 17:04:00 +0000 (GMT)
duncan (D.C.Martin.2000 from Cranfield.ac.uk)

I read with interest about how g77 works. I plan on using it when I get a chance. The questioner would probably find it useful to check out www.fortran.com - it has links to many different Fortran products, services, and benchmark tests, and a lot of what is on there is relevant to/directly aimed at linux users. Many compilers seem to be aimed squarely at the linux market. I guess that is because of the popularity of Beowulf type clusters, but it's nice to know that even where almost everything is (visibly) written in C there is still room for Fortran.
Hope this helps
Cheers
Duncan
ps TAG is great. Keep it up.

### Agenda Computing Challenges Palm

Thu, 15 Mar 2001 16:34:11 -0800 (PST)
Heather (The Editor Gal)

Is this press release true? Can somebody summarize how far the Linux-on-PDAs projects have gotten?

Handhelds.org has a great deal of information about putting Linux onto PDAs. Transvirtual's PocketLinux (their penguin is very cute - his whole tummy is a pocket protector) runs on iPaq, VTech's Helio, maybe others by now. The pocketlinux has to be put on by having a dev environment on another box, but this is no different than the first fellow who forcefed Linux onto his laptop across its plink cable or ethernet crossover. The result is operational without an external bootstrap, but varies in usability.

Certainly some complete OS bigots have tried to put Linux on their Palms.

Agenda may be the first to actually sell a PDA preloaded with Linux, and not designed for some other OS first, though.

And, their Linux environment has the usual PDA features, rather than trying to be X or a terminal. -- Heather

----- Forwarded message from Agenda Computing -----

Subject: Agenda Computing Challenges Palm Date: Fri, 9 Mar 2001 19:49:05 -0800 (PST)

The complete text of their Press Release can be found at http://www.agendacomputing.com/about/press20010309.html

### Mailbag #62; Memory mystery

Tue, 20 Mar 2001 12:35:52 +0100
Frode Lillerud (frode.lillerud from c2i.net)

I know that Abit had a similar problem with their BH6 motherboard, Linux wouldn't show RAM over 64MB. They solved it by releasing a BIOS patch.

Yours sincerely
Frode Lillerud, Norway

### mcad

Mon, 26 Mar 2001 09:29:15 -0800 (PST)
Heather (The Editor Gal)

Hello. I keep seeing the term "mechanical CAD", but am not sure of it's actual meaning. What is mechanical CAD and what differentiates it from CAD? Thanks. RES

This isn't really a question about Linux, but I'll toss in a potshot.

There are absolutely piles of CAD software available for Linux. Most of it appears to be for cirvuitboard description. That's not terribly useful for developing instructions to send to a metal lathe so a part can be cut. And both of these are very different from architectural CAD for designing building layouts.

I would guess that by saying "mechanical CAD" one could easily note that you meant the second kind.

##### This page edited and maintained by the Editors of Linux Gazette Copyright © 2001
Published in issue 65 of Linux Gazette April 2001

###### HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/