old-www/LDP/LG/issue26/lg_tips26.html

575 lines
21 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>More 2 Cent Tips & Tricks Issue 26</title>
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <hr> <P>
<!-- QUICK TIPS SECTION ================================================== -->
<center>
<H1><A NAME="tips"><IMG ALIGN=MIDDLE ALT="" SRC="../gx/twocent.gif">
More 2&#162; Tips!</A></H1> <BR>
Send Linux Tips and Tricks to <A HREF="mailto:gazette@ssc.com">
gazette@ssc.com
</A></center>
<p><hr><p>
<H3>Contents:</H3>
<ul>
<li><a HREF="./lg_tips26.html#apache">Apache SSL extensions...</a>
<li><a HREF="./lg_tips26.html#locate">Locate</a>
<li><a HREF="./lg_tips26.html#print">Re: Printing Problems</a>
<li><a HREF="./lg_tips26.html#net">Re: LG25, Netscape on the Desktop</a>
<li><a HREF="./lg_tips26.html#vax">Re: Linux and VAX 3400 and 3300</a>
<li><a HREF="./lg_tips26.html#binary">Binary File Access with dd</a>
<li><a HREF="./lg_tips26.html#find">Follow up to find 2c-tip</a>
<li><a HREF="./lg_tips26.html#ispell">ispell & Pine 3.96</a>
<li><a HREF="./lg_tips26.html#xvscan">XVSCAN: Combining different parts
together </A>
<li><a HREF="./lg_tips26.html#scape">2c-tip: Netscape on the Desktop</A>
<li><a HREF="./lg_tips26.html#win">Linux and Win95</A>
<li><a HREF="./lg_tips26.html#su">My $0.02 tip: Graphical su</A>
<li><a HREF="./lg_tips26.html#eggs">Easter Eggs in Netscape</A>
<li><a HREF="./lg_tips26.html#core">Core Dumps</A>
</ul>
<P> <hr> <P>
<!--================================================================-->
<a name="apache"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Apache SSL extensions...
</H3>
Date: Fri, 27 Feb 1998 15:49:41 -0800<BR>
From: Glenn D'mello, <A HREF="mailto:glenn@arbornet.org">
glenn@arbornet.org</A> <BR>
<blockquote> <I>
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... </I> </blockquote>
<P>
This is how I did it:
<ol>
<li>Get SSLeay 0.8.0 or later from
ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL
<li>Build and test and install it!
<li>Get Apache 1.2.5 source
<li>Get Apache SSLeay extensions from
ftp://ftp.ox.ac.uk/pub/crypto/SSL/apache_1.2.5+ssl_1.13.tar.gz
<li>Unpack it in the apache-1.2.5 source directory and patch Apache as
per the README.
<li>Configure and build it.
<li>Read the docs before building (set your paths, etc, etc)
</ol>
Worked the first time too!
Hope this helps:
<P>
Glenn.
<P> <hr> <P>
<!--================================================================-->
<a name="locate"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Locate
</H3>
From: John Corey, <A HREF="mailto:norm@comanche.dyn.ml.org">
norm@comanche.dyn.ml.org</A>
<P>
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 <A HREF="./locate.diff">patch</A> 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.
<P>
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.
<P>
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).
<P>
Enjoy
<P> <hr> <P>
<!--================================================================-->
<a name="print"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Re: Printing Problems
</H3>
<P>
Date: Wed, 04 Feb 1998 22:05:40 +0100 <BR>
From: M.H.M. Verhoeven, <A HREF="mailto:leeuweri@stad.dsl.nl">
leeuweri@stad.dsl.nl</A>
<blockquote> <I>
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> </blockquote>
<p>
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.
<p>
Gertjan
<P> <hr> <P>
<!--================================================================-->
<a name="net"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Re: LG25, Netscape on the Desktop
</H3>
<P>
Date: Thu, 05 Feb 1998 00:26:03 +0100 <BR>
From: Soenke J. Peters, <A HREF="mailto:peters@on-line.de">
peters@on-line.de</A>
<p>
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.
<p>
Soenke J. Peters, Hamburg, Germany
<P> <hr> <P>
<!--================================================================-->
<a name="vax"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
RE: Linux and VAX 3400 and 3300
</H3>
<P>
Date: Thu, 05 Feb 1998 10:11:00 -0700 <BR>
From: James Gilb, <A HREF="mailto:p27451@email.sps.mot.com">
p27451@email.sps.mot.com</A>
To: dennis.j.smith@ArthurAndersen.com
<blockquote>
<I>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>
</blockquote>
<P>
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/
<p>
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.
<p>
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?
<p>
James Gilb
<P> <hr> <P>
<!--================================================================-->
<a name="binary"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Binary File Access with <tt>dd</tt>
</H3>
<p>Date: February 9, 1998<br>
From: Leonard R Budney <a
href="mailto:budney@fore.com">lbudney@fore.com</a><br></p>
<p><tt>dd</tt> stands for <em>Disk Dump.</em> Or if it doesn't it
should. The "main" use for <tt>dd</tt> 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 <tt>rawrite.</tt> If you're sick of
keeping boxes of floppies around, you can use <tt>dd</tt> in
reverse, and throw the floppy away. Depending on permissions, you
might have to do this as root.</p>
<pre>dd if=/dev/fd0 of=quicken_install_disk_1.img bs=1440k</pre>
<p>The <tt>if</tt> argument specifies an input file (which defaults
to the standard input). Naturally, the <tt>of</tt> argument names
the output file (which defaults to the standard output). Finally,
the <tt>bs</tt> argument tells <tt>dd</tt> what <em>block size</em>
to use. Here we set the block size equal to the size of a floppy
disk, and let <tt>dd</tt> read one block of data.</p>
<p>The man page says that the purpose of <tt>dd</tt> is to "convert
a file while copying it." In English, that means that <tt>dd</tt>
does <em>not</em> 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.</p>
<p>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.</p>
<pre>dd if=/dev/random of=/tmp/random.bin bs=1 count=10</pre>
<p>Note that /dev/random provides binary data, so if we omit the
<tt>of</tt> argument then that data will probably trash our display.
Alternately, we could have omitted the <tt>of</tt> argument, but
piped the output through <tt>cat -v</tt> to escape any non-printable
characters. In addition to the arguments explained above, we use
the <tt>count</tt> argument to specify the number of blocks to read.
In conjunction with a blocksize of 1, <tt>count=10</tt> tells
<tt>dd</tt> to read exactly 10 bytes.</p>
<p>Here's a final example, for the paranoid. When you delete a file
using <tt>rm,</tt> 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,
<tt>dd</tt> comes to the rescue. Normally <tt>dd</tt>
<em>truncates</em> its output file before writing. The argument
<tt>conv=notrunc</tt> overrides that behavior, and causes
<tt>dd</tt> 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.</p>
<pre>
#!/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
</pre>
<p>Enjoy!<br>
Len.</p>
<P> <hr> <P>
<!--================================================================-->
<a name="find"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Follow-up to find 2c-tip
</H3>
<P>
Date: Tue, 10 Feb 1998 19:20:44 +0000 <BR>
From: Markus Pilzecker, <A HREF="mailto:mp@rhein-neckar.netsurf.de">
mp@rhein-neckar.netsurf.de</A>
<p>
in your December issue, one of the 2-cents about find had been:
<p><blockquote>
<I>A shorter and more efficient way of doing it uses backticks:</I><BR>
<tt> grep "string" `find . -type f`</tt><BR>
<I>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. </I> </blockquote>
<p>
The solution to this is using xargs:
<pre>
find &lt;find_roots&gt; &lt;other_options&gt; -print0 | xargs -0 grep &lt;options&gt;
</pre>
. 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.
<p>
The find option ``-print0'' and the xargs option ``-0'' work together
to assure correct handling of odd filenames.
<p>
Markus
<P> <hr> <P>
<!--================================================================-->
<a name="ispell"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
ispell & Pine 3.96
</H3>
<P>
Date: Fri, 13 Feb 1998 08:39:34 -0800 (PST) <BR>
From: Peter Struijk
<p>
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.
<P>
Peter
<P> <hr> <P>
<!--================================================================-->
<a name="xvscan"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
XVSCAN: Combining different parts together
</H3>
<P>
Date: Sat, 13 Sep 1997 01:04:29 -0500<BR>
From: Earl Fryman, <A HREF="mailto:fryman@io.com">fryman@io.com</A> <BR>
To: xvscanlist@tummy.com
<P>
<blockquote> <I>
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.<BR>
--<BR>
Juha Perkkio, juha.perkkio@mikkeliamk.fi
</I> </blockquote>
<P>
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.).
<P>
Earl Fryman
<P> <hr> <P>
<!--================================================================-->
<a name="scape"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
2c-tip: Netscape on the Desktop
</H3>
<P>
Date: Sun, 15 Feb 1998 19:43:58 -0100<BR>
From: Victor-A. Bruessow, <A HREF="mailto:Christian.Bruessow@t-online.de">
Christian.Bruessow@t-online.de</A>
<P>
I'm using this little bash script to start Netscape:
<pre>
#!/bin/sh
if [ $1 ] ; then
REMOTE_COMMAND="openURL($@,new-window)"
else
REMOTE_COMMAND="openBrowser"
fi
netscape -remote $REMOTE_COMMAND || netscape $@
</PRE>
I think it has some advantages over the script from Tim Hawes:
<ul>
<li>no need to look for a lock file, which means:
<li>it even starts Netscape, if there is a stale lock file from a crashed
browser session :-)
<li>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)
</ul>
Christian
<P> <hr> <P>
<!--================================================================-->
<a name="win"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Linux and Win95
</H3>
<P>
Date: Wed, 18 Feb 1998 14:55:22 +1300<BR>
From: Justin Lodge, <A HREF="mailto:justin.lodge@optimation.co.nz">
justin.lodge@optimation.co.nz</A>
<P>
Rexson
Re: Your Question e-mail to Linux Gazette
<P>
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.
<P>
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.
<P>
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.
<P>
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.
<P>
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.
<P>
doctor linux has good beginners sections and more complex ones about
dual booting Win95 and Linux
<P>
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.
<P>
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.
<P>
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.
<P>
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.
<P>
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.
<P>
Justin
<P> <hr> <P>
<!--================================================================-->
<a name="su"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
My $0.02 tip: Graphical su
</H3>
<P>
Date: Wed, 18 Feb 1998 22:01:25 +0100 (CET)<BR>
From: Andreas Kostyrka, <A HREF="mailto:andreas@rainbow.studorg.tuwien.ac.at">
andreas@rainbow.studorg.tuwien.ac.at</A>
<P>
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:
<PRE>
$ xauth list $DISPLAY # mark the output
$ su -
# xauth add &lt;paste the above line&gt;
# export DISPLAY=&lt;display mentioned in the pasted line.)
</PRE> <P>
*) The overkill net way:
<PRE>
$ ssh localhost -l root
</PRE> <P>
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.
<P>
*) The graphical (XDM) way, or the way to show off for your WinNT friends:
<PRE>
$ Xnest :10 -query localhost &
</PRE>
: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.)
<P>
Andreas Kostyrka
<P> <hr> <P>
<!--================================================================-->
<a name="eggs"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Easter Eggs in Netscape
</H3>
<P>
Date: Wed, 18 Feb 1998 13:32:57 -0800 (PST)<BR>
From: Eric Geyer, <A HREF="mailto:corduroy@sfo.com">corduroy@sfo.com</A>
<P>
I saw the list of Easter Eggs in Netscape, and I have two more, both much less
useful than the ones you listed.
<PRE>
about:mozilla
</PRE>
On all the Unix netscapes I've seen, it changes the Netscape logo in the upper
right.
<PRE>
about:jzw
</PRE>
This will take you to Jamie Zawinski's homepage, and will change the Netscape
logo on Unix netscape except for version 4.
<P>
Just thought you would like to know...
<P>
Eric Geyer
<P> <hr> <P>
<!--================================================================-->
<a name="core"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Core Dumps
</H3>
<P>
Date: Thu, 19 Feb 1998 13:56:51 PST<BR>
From: Marty Leisner, <A
HREF="mailto:leisner@sdsp.mc.xerox.com">leisner@sdsp.mc.xerox.com</A>
<P>
I was annoyed on Linux that file(1) couldn't tell what file
dumped core if a core dump was seen.
<P>
For a while, I was doing strings | head and guess at it by inspection.
<P>
But size will do the job:
<PRE>
: leisner@dw;size core
text data bss dec hex filename
45056 295036 0 340092 5307c core (core file invoked as minicom - dpp2)
</PRE>
<P>
marty
<P> <hr> <P>
<!--================================================================-->
<center>Published in <I>Linux Gazette</I> Issue 26, March 1998</center>
<P> <hr> <P>
<!--================================================================-->
<A HREF="./index.html"><IMG SRC="../gx/indexnew.gif" ALT="[ TABLE OF
CONTENTS ]"></A> <A HREF="../index.html"><IMG SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A> <A HREF="./lg_mail26.html"><IMG SRC="../gx/back2.gif" ALT=" Back "></A>
<A HREF="./lg_bytes26.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<h5>This page maintained by the Editor of <I>Linux Gazette</I>,
<A HREF="mailto: gazette@ssc.com">gazette@ssc.com</A><BR>
Copyright &copy; 1998 Specialized Systems Consultants, Inc. </H5>
<P>
<!--startcut ==========================================================-->
</body>
</html>
<!--endcut ============================================================-->