More 2 Cent Tips & Tricks Issue 26

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

# More 2¢ Tips!

Send Linux Tips and Tricks to gazette@ssc.com

### Contents:

- Apache SSL extensions...
- Locate
- Re: Printing Problems
- Re: LG25, Netscape on the Desktop
- Re: Linux and VAX 3400 and 3300
- Binary File Access with dd
- Follow up to find 2c-tip
- ispell & Pine 3.96
- XVSCAN: Combining different parts together
- 2c-tip: Netscape on the Desktop
- Linux and Win95
- My $0.02 tip: Graphical su
- Easter Eggs in Netscape
- Core Dumps

### Apache SSL extensions...

Date: Fri, 27 Feb 1998 15:49:41 -0800
From: Glenn D'mello, glenn@arbornet.org

> From Frank: My problem is this one ... I've gone bananas in trying to find a document that explains how to install, in a step by step fashion, the Apache SSL "extensions" to one of my Apache WWW Webservers (the performance increase is awesome) can you or anyone that reads this help...

This is how I did it:

1. Get SSLeay 0.8.0 or later from ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL
2. Build and test and install it!
3. Get Apache 1.2.5 source
4. Get Apache SSLeay extensions from ftp://ftp.ox.ac.uk/pub/crypto/SSL/apache_1.2.5+ssl_1.13.tar.gz
5. Unpack it in the apache-1.2.5 source directory and patch Apache as per the README.
6. Configure and build it.
7. Read the docs before building (set your paths, etc, etc)

Worked the first time too! Hope this helps:

Glenn.

### Locate

From: John Corey, norm@comanche.dyn.ml.org

One of my annoyances with the locate program have been that with it, users can see files they have no access to otherwise. So, I have deviced a little patch to the original sources to fix that, along with a few other annoyances. It inherently does a few other things as well. It will only list files that do currently exist (not just files that existed when updatedb was last run). Also, it adds the option -l to locate which simply performs a ls -l on the files returned.

To compile, get the sources from ftp://prep.ai.mit.edu/pub/gnu/findutils-4.1.tar.gz . Extract that, then apply the attached diff to it with: patch < locate.diff, and compile per the instructions within findutils.

The only file modified is locate.c, so you can skip the installation process if you already have updatedb/locate installed, and just simply replace your existing locate binary with the new one (keeping a backup of the original, should anything evil happen).

Enjoy

### Re: Printing Problems

Date: Wed, 04 Feb 1998 22:05:40 +0100
From: M.H.M. Verhoeven, leeuweri@stad.dsl.nl

> Anyone that can help me. I'd love to hear it. I try running lpr, but everytime I get no name for local machine. How do I set this and/or what is the problem. -- Manish Oberoi

I had the same problems with printing (no name for local machine). You should put a entry for your machine in /etc/hosts, and your problem is solved. In my case, the name of my computer had changed, but /etc/hosts still contained the old name for my machine.

Gertjan

### Re: LG25, Netscape on the Desktop

Date: Thu, 05 Feb 1998 00:26:03 +0100
From: Soenke J. Peters, peters@on-line.de

I use a similar trick to start up the browser-/mail-/news-window from three different buttons in my windowmanager's panel. For the mail-window, you have to start the script with 'mailbox:' as the url parameter, for the news-window simply use 'news:'. For urls beginning different from the above, netscape opens the normal browser window.

Soenke J. Peters, Hamburg, Germany

### RE: Linux and VAX 3400 and 3300

Date: Thu, 05 Feb 1998 10:11:00 -0700
From: James Gilb, p27451@email.sps.mot.com To: dennis.j.smith@ArthurAndersen.com

> I have just purchased a MicroVAX 3400 and 3300. I would like to put Linux on these two systems. Can you provide any help in this aspect.

I believe those are MIPS 3000 boxes, try the Linux VAX Port Homepage at http://ucnet.canberra.edu.au/~mikal/vaxlinux/home.html and the Linux/MIPS project at http://lena.fnet.fr/

My guess is that you will need to get your hands dirty on this one. You could also try NetBSD, they may have a port now.

If they are not MIPS boxes, then you could have a real challenge on you hands, but then isn't that half the fun of Linux?

James Gilb

### Binary File Access with `dd`

Date: February 9, 1998
From: Leonard R Budney lbudney@fore.com

`dd` stands for Disk Dump. Or if it doesn't it should. The "main" use for `dd` is to duplicate a floppy disk, bit for bit, to a file. You probably used it to create boot disks when you installed Linux for the first time, unless you used its much less functional cousin `rawrite.` If you're sick of keeping boxes of floppies around, you can use `dd` in reverse, and throw the floppy away. Depending on permissions, you might have to do this as root.

    dd if=/dev/fd0 of=quicken_install_disk_1.img bs=1440k

The `if` argument specifies an input file (which defaults to the standard input). Naturally, the `of` argument names the output file (which defaults to the standard output). Finally, the `bs` argument tells `dd` what block size to use. Here we set the block size equal to the size of a floppy disk, and let `dd` read one block of data.

The man page says that the purpose of `dd` is to "convert a file while copying it." In English, that means that `dd` does not assume a file is made of text! It doesn't look for carriage returns to delimit lines, it doesn't stop reading at the first binary zero, nothing! This gives us the power to read files exactly, byte for byte. It allows us to read a fixed number of bytes, or physically to overwrite a file.

As just one example, consider /dev/random. That's a nifty Linux innovation--a pseudo device that accumulates randomness. Would you like to read 10 bytes of random data from /dev/random? It's a snap.

    dd if=/dev/random of=/tmp/random.bin bs=1 count=10

Note that /dev/random provides binary data, so if we omit the `of` argument then that data will probably trash our display. Alternately, we could have omitted the `of` argument, but piped the output through `cat -v` to escape any non-printable characters. In addition to the arguments explained above, we use the `count` argument to specify the number of blocks to read. In conjunction with a blocksize of 1, `count=10` tells `dd` to read exactly 10 bytes.

Here's a final example, for the paranoid. When you delete a file using `rm,` you only delete the inode pointing to your data. The data is still there, on the disk, waiting for somebody with a "Disk Doctor" utility to resurrect and read. Does that bother you? Well, you should delete your data, not just your file. Again, `dd` comes to the rescue. Normally `dd` truncates its output file before writing. The argument `conv=notrunc` overrides that behavior, and causes `dd` to write over any existing data. The following shell script combines all of these ideas, and wipes out your file by overwriting it five times with pseudorandom data, and then deleting it.

    #!/bin/sh
    FILE=$1
    SIZE=`ls -l $FILE | awk -- '{print \$5;}'`
    {
        for iteration in 1 2 3 4 5
        do
            dd if=/dev/urandom of=$FILE bs=${SIZE} count=1 conv=notrunc
            sync
        done
    } && rm -f $FILE

Enjoy!
Len.

### Follow-up to find 2c-tip

Date: Tue, 10 Feb 1998 19:20:44 +0000
From: Markus Pilzecker, mp@rhein-neckar.netsurf.de

in your December issue, one of the 2-cents about find had been:

> A shorter and more efficient way of doing it uses backticks:
> `grep "string" `find . -type f``
> Note however, that if the find matches a large number of files you may exceed a command line buffer in the shell and cause it to complain.

The solution to this is using xargs:

    find <find_roots> <other_options> -print0 | xargs -0 grep <options>

. xargs only puts as much onto grep's [or whatever else's] command line as fits without overflow. Only in the latter case will it start a new instance of grep. The trick of the first proposal to add ``/dev/null'' to grep's command line to make it print the name of the file in work is [mostly] superfluous then, since xargs [mostly] puts more than one filename onto grep's command line.

The find option ``-print0'' and the xargs option ``-0'' work together to assure correct handling of odd filenames.

Markus

### ispell & Pine 3.96

Date: Fri, 13 Feb 1998 08:39:34 -0800 (PST)
From: Peter Struijk, peter@ssc.com

To use ispell in Pine, go into Pine SETUP (press S, then C), search using WhereIs for "speller" (press W) and make sure the value set there is "ispell". That will do it.

Peter

### XVSCAN: Combining different parts together

Date: Sat, 13 Sep 1997 01:04:29 -0500
From: Earl Fryman, fryman@io.com
To: xvscanlist@tummy.com

> Is it possible to combine two (or more) different parts from different pages on same fig? For example, if I scan pages and want to print transparencies from small part of the text enlarged. Now, if the part 1 is at the end of a page and the part 2 is on the following page, I have not been able to combine them on one single fig (part 1 and below it part 2). How could I do that with xvscan? If the parts are on the same page I have used cut, past and crop.
> --
> Juha Perkkio, juha.perkkio@mikkeliamk.fi

Yes it is posible. Load the first image and select the portion of the image to cut. Press Alt-C (hold down Alt key and press C). Load the second image and press Alt-V. A frame window the size of the cut in the first image will appear. Position the frame where you want the image to be pasted, then press Alt-V (again). This even works if the two image are of different type (bmp, jpg, gif, etc.).

Earl Fryman

### 2c-tip: Netscape on the Desktop

Date: Sun, 15 Feb 1998 19:43:58 -0100
From: Victor-A. Bruessow, Christian.Bruessow@t-online.de

I'm using this little bash script to start Netscape:

    #!/bin/sh
    if [ $1 ] ; then
       REMOTE_COMMAND="openURL($@,new-window)"
    else
       REMOTE_COMMAND="openBrowser"
    fi

    netscape -remote $REMOTE_COMMAND || netscape $@

I think it has some advantages over the script from Tim Hawes:

- no need to look for a lock file, which means:
- it even starts Netscape, if there is a stale lock file from a crashed browser session :-)
- you can call it without any arguments, it doesn't matter if there is a running Netscape or not ("openURL($@,new-window)" will cause an error, if "$@" is empty, so I use "openBrowser" instead)

Christian

### Linux and Win95

Date: Wed, 18 Feb 1998 14:55:22 +1300
From: Justin Lodge, justin.lodge@optimation.co.nz

Rexson Re: Your Question e-mail to Linux Gazette

Your big problem is that Win95 has probably helped itself to the entire drive already - so there is no space left available to install extra Linux partitions.

What you really should do first is to back up all the existing partitions using a tape or a Zip or a Jaz drive. Let me guess you don't have one of these..... if you can beg/borrow/steal one temporarily and back everything up before you do anything that would be good.

Maybe your D: partition doesn't hold much and you can transfer the data to the C: drive where Win95 is installed - this will allow you to re-use the D: partition for Linux.

Next - buy/beg/borrow/steal a recent copy of Red Hat for Linux (make sure you get the book and the floppy disks that come with the CD) and the Doctor Linux book.

Red Hat has a beginners book with it that explains a lot that you need to know to install Linux and a set of excellent scripts that lead you though the installation.

doctor linux has good beginners sections and more complex ones about dual booting Win95 and Linux

I would recommend that you DO NOT try to make the machine dual boot - it could cock-up the win95 installation but these articles will help you understand the mechanics around this area. The HOWTO articles in Doctor Linux are all available on the Internet if you don't want to buy a book but having a hard copy to reference is much easier.

once you have re-located any useful data off the D: to the C: then use the disk partitioning tool that comes with red hat to de-allocate the D: partition and then create the root, usr, swap and home (and any others) in this area. From memory I believe that the root partition has to be in a primary partition but all the rest can be logical partitions contained in a single "extended" partition.

This re-allocation of partitions is EXTREMELY dicey - make absolutely sure you understand which partition is C: and which is D: IF you de-allocate C by mistake then it is almost definitely un-recoverable unless you have Norton for Win95 or something similar that can repair the damage.

Create a boot diskette using red hat so that when you want to run Linux you just plug it in and re-boot the machine - booting off the floppy may seem awkward but it is much much faster than any version of Windoze.

Any one else using the family using the machine will not have this boot diskette and will not be able to see your partitions from Win95 and won't even know that Linux is there. This is how I keep my family off my copy of Linux.

Justin

### My $0.02 tip: Graphical su

Date: Wed, 18 Feb 1998 22:01:25 +0100 (CET)
From: Andreas Kostyrka, andreas@rainbow.studorg.tuwien.ac.at

Sometimes one want to do su but be able to use X11 programs like RH control-panel. There are several ways to accomplish this: *) The hard way: su - and copy&paste the xauth:

    $ xauth list $DISPLAY # mark the output
    $ su -
    # xauth add <paste the above line>
    # export DISPLAY=<display mentioned in the pasted line.)

*) The overkill net way:

    $ ssh localhost -l root

This depends upon you haveing installed ssh (ftp.replay.com is the site where one gets the crypto stuff for RH Linux in .rpms), and is probably not that fast, as it uses a X11 proxy forwarding server.

*) The graphical (XDM) way, or the way to show off for your WinNT friends:

    $ Xnest :10 -query localhost &

:10 must be perhaps customized if it is already in use. localhost is your xdm host. This should work if you use xdm for login. (==You have a graphical login screen.)

Andreas Kostyrka

### Easter Eggs in Netscape

Date: Wed, 18 Feb 1998 13:32:57 -0800 (PST)
From: Eric Geyer, corduroy@sfo.com

I saw the list of Easter Eggs in Netscape, and I have two more, both much less useful than the ones you listed.

    about:mozilla

On all the Unix netscapes I've seen, it changes the Netscape logo in the upper right.

    about:jzw

This will take you to Jamie Zawinski's homepage, and will change the Netscape logo on Unix netscape except for version 4.

Just thought you would like to know...

Eric Geyer

### Core Dumps

Date: Thu, 19 Feb 1998 13:56:51 PST
From: Marty Leisner, leisner@sdsp.mc.xerox.com

I was annoyed on Linux that file(1) couldn't tell what file dumped core if a core dump was seen.

For a while, I was doing strings | head and guess at it by inspection.

But size will do the job:

    : leisner@dw;size core
    text    data    bss     dec     hex     filename
    45056   295036  0       340092  5307c   core (core file invoked as minicom - dpp2)

marty

Published in Linux Gazette Issue 26, March 1998

##### This page maintained by the Editor of Linux Gazette, gazette@ssc.com
Copyright © 1998 Specialized Systems Consultants, Inc.