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

Copyright © 1996-97 Specialized Systems Consultants, Inc. linux@ssc.com


Welcome to Linux Gazette!(tm)

Sponsored by:

InfoMagic

Our sponsors make financial contributions toward the costs of publishing Linux Gazette. If you would like to become a sponsor of LG, e-mail us at sponsor@ssc.com.


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


 The Mailbag!

Write the Gazette at gazette@ssc.com

Contents:


Help Wanted -- Article Ideas


 Date: Wed, 02 Jul 1997 22:30:26 -0700
From: Wood Ellis woodswrk@erols.com
Subject: Newbie Needs More Definitive Article on Parallel Port Tape Drives

The various leads which can be followed from the parport home page tend to indicate that it's just not worth all the hassle to try to operate a tape on the parallel port, unless you are an expert and maybe want to program it yourself. I just cannot believe that it is that difficult.

I would appreciate it if you were to provide an article which, in simple, newbie language, tells how to do it. The article should include definitive solutions for every brand of parallel port tape drive which is commonly available. Mine is an HP-1000 travan-1. My system is Redhat 4.1. One can imagine that some linux devotees enjoy the abstruseness of things new and difficult and exclusive. Contrary to that viewpoint, I believe that we all should strive to make linux easier and more available to the relatively uninformed. Probably you share my feeling. That's as close as I can come to a flaming request right now. I really appreciate all the good stuff in the Gazette.

Thank you,


 Date: Sun Jul 6 16:35:46 1997
From: Takkala, takkala@highstar.com
Subject: Please help me....

Recently, ever since I upgraded to Slackware 3.2/Redhat 4.1, I have noticed that my modem has been behaving rather erratically. My modem is a Motorola ModemSurfr 28.8. Now, when I type 'ppp-on' to initiate a ppp session, many times, the modems TR led lights up, and then nothing happens, until the computer times out 45 seconds later and aborts the ppp session. Normally, when I type 'ppp-on' the modem almost immediately begins dialing up my isp, and connecting, but most of the time, it would just sit there, until I killed the process and tried again, it may take up to twelve or more tries for the modem to dial, but sometimes it will dial on the first try. This erratic behavior only began occurring (from what I can tell, I'm not sure) ever since I upgraded to redhat 4.1, and now slackware 3.2. My modem does work fine in windows 95, and also if I use DIP, or minicom to try and connect. So I was wondering if this may be a timing error somewhere in the ppp-on script. Has anyone else had similar problems? I myself tried tweaking some of the abort timeouts, but that didn't help.

Someone please help me! Thanks for any help suggestions...
Jari


 Date: Mon, 07 Jul 1997 01:00:35 -0700
From: Paul M., pmarcano@saltspring.com
Subject: Deluxe Paint IIe

Don't mean to come out of the blue but... I was searching the net for some reference to Deluxe Paint IIe for the PC and ended up here... Can you send me any information you can about how I might get a hold of a copy of this program which I assume is discontinued. I come from an Amiga background and still feel there are some redeeming features to this program that I would like to use on my PC...

Thanks for any information you can impart!

Paul Marcano


 Date: Fri, 11 Jul 1997 16:57:33 -0300
From: Annette Sahores annette@invap.com.ar
Subject: Problem with adaptec 2940U

I'm trying to install linux red hat 2.0.x in a machine with an Adaptec 2940U host adapter an a scsi external 4x cdrom. The problem is that the bootdisk does not recognize the host adapter, so I can't set the linux and swap partitions. may be the problem is that the driver aic7xxx is old and doesn't work whith the 2940 ultra.

Thank You
Annette Sahores


 Date: Tue, 15 Jul 97 15:01:00 PDT
From: Mark Mangolas mmango01@gsg.eds.com
Subject: Linux on a ThinkPad

Hello,
I am writing this in hopes that you can help me with my Linux configuration. I have Linux Slackware 3.2 running on an IBM 760E Thinkpad and I can't get X to run properly. It scrunches the screen when I fire up X and then scrambles everything when I exit forcing me to reboot. I've tried almost all of the video cards, chipsets, etc. in XF86Setup and nothing helps. Any help would be greatly appreciated......thank you,

Mark Mangolas


 Date: Wed, 16 Jul 1997 15:01:49 -0400
From: Scott Fowler scorpi04@earthlink.net
Subject: Pnp Modem and mouse

Help I have a plug and pray modem and mouse, actually my mouse is a ps/2 mouse, will the program isapnptools fix all the pnp problems?


 Date: Sun, 20 Jul 1997 10:43:54 -0600
From: Doug Milligan, Red Hat Linux User doug@nwrks.com
Subject: Disk deferag?

I'm new to Linux, but like it very much having recently installed RedHat 4.2 via FTP. In looking through utility software I have not run accross any disk defragmentor programs nor have seen references to them in any Linux books that I have consulted. Is disk degragmentation not needed in maintaining a Linux file system?

Thanks,
Doug Milligan


 Date: Sat, 19 Jul 1997 18:58:20 +0200 (SAT)
From: Abraham vd Merwe ixion@ilink.nis.za
Subject: Chown Problem

Hi!

You can make anybody the owner of your files right? At least that is w hat I always thought, but take a look at this:

% whoami
ixion
% cat /dev/null > ChownTest ; chmod 0777 ChownTest ; ls -l ChownTest
-rwxrwxrwx   1 ixion    users           0 Jul 19 18:10 ChownTest
% cat /etc/passwd | grep fakeuser
fakeuser:x:1005:100:Nobody:/home/fakeuser:/bin/bash
% chown fakeuser ChownTest
chown: ChownTest: Operation not permitted

I've tried it on various systems and it turns out that I can't make an ybody the owner of my files when I'm a user (root obviously can). Why? I'd b e very grateful if you can explain how to do it or if not possibly, at l east why I can't do it...

Thanks
Abraham


 Date: Sat, 19 Jul 1997 04:40:56 +0100
From: Emmet emmet@indigo.ie
Subject: Firewire and DV

Hi,
I've nearly got my brother converted to Linux, except he's interested in using firewire cards and whatever software to edit video from a DV camera. After some web-searching, and a several sites, it seems that there are no firewire drivers or spiffy DV software for Linux.

Even worse, Adaptec, who manufacture what appears to be becoming a very popular card, are only supporting MS and Mac platforms. To add insult to injury, their FAQ, in response to a question about the possibility of drivers for Un*x, etc., contains the single word "No", no explanation or euphemisms, just "No".

At this point in time, horror of horrors, it looks like I'm going to wind up with my brother using NT. Frankly, I'd rather have a sister in a whorehouse than a brother using NT. Check out Mitch Stone's excellent site at http://www.vcnet.com/bms for why.

Does anybody know different? Are there any plans afoot in this direction? Maybe somebody in a position of influence could lean on some firewire card manufacturers to make their driver software available for porting to Linux? Maybe the Linux community could email sales@adaptec.com or support@adaptec.com asking them to reconsider making drivers available?

Any information about the possibility of DV editing software or firewire drivers would be most appreciated. I'll help if I can.

Thanks,
Emmet.


 Date: Wed, 23 Jul 1997 22:24:44 -0500
From: Ben and Nick nbwbolen@bstream.com
Subject: cpu Speed

I was wondering if you could tell me where I could get a listing of bogomites? bogomytes? on different cpu's and computers?
Thanks Ben


 Date: Wed, 23 Jul 1997 15:56:49 -0400 (EDT)
From: Jon Lewis jlewis@inorganix5.fdt.net
Subject: Linux Uptimes

Do you have any idea what the longest uptime on a linux system is? I have a system with over 14 months of uptime, and am wondering if its heading for some kind of record. I've been told that with the 1.2.x kernels, uptimes longer than about 16.4 months are thought to be impossible due to jiffy counter wrap.


 Date: Thu, 3 Jul 1997 19:12:36 -0700 (PDT)
From: Greg Roelofs newt@pobox.com
Subject: Re: Changing video modes

A friend of mine wants to know how to change video modes without restarting X, and I noticed you say you can do that on your Linux page. How can this be done? (I'm using XFree86, he's using MkLinux)

Just changing *modes* is easy: use ctrl-alt-gray+ and ctrl-alt-gray- to cycle between the resolutions defined in your XF86Config file. I have the following defined:

Modes   "1280x1024" "1536x1152" "1600x1200" "640x480" "800x600" "1024x768"
To run multiple X servers is a little trickier, and I've been meaning to write up a Linux Gazette or Linux Journal article on that. Assuming you use startx instead of xdm, the basic trick is to do something like this:
startx -- :4 -bpp 32 &
My default (16-bit mode) command is this:
startx -- :1 -bpp 16 &
You can switch between them via ctrl-alt-F7 through F10, typically-- F1 through F6 tend to be normal text-mode Linux consoles.

It's really best to alias these things and make sure the screen numbers (:0 or :2 or whatever) don't collide; if they do, the second X server will "steal" the number from the first, and you won't be able to start any more windows or even restart the window manager under the first server.

The special 320x200 game mode is even more complicated, and I won't even try to explain that here. It can be done with a second XF86Config or with additional lines in the main one under some circumstances.

I don't know how AccelX and XiGraphics and MetroX handle these things.

-- Greg Roelofs


General Mail


 Date: Mon, 07 Jul 1997 10:27:46 -0700
From: James Gilb p27451@am371.geg.mot.com
Subject: *2+ Processing

Check out the Linux SMP page at http://www.uk.linux.org/SMP/title.html and get a new distribution. I think that SMP became part of the standard kernel at 2.0, so 2.0.?? might be a good choice (check out the SMP page, I think some patch levels are broken with respect to SMP).

If you are pretty good a Linux installs (and from the multiplicity of your OS's is sounds like you are), you could pick up a RedHat distribution for less than USD $10. I can't help you with availability in Sweden, but check out Caldera, RedHat, Craftworks, SuSE and Yggdrasil (sp?), I think most of them support SMP. If you need pointers to their web pages, try http://www.linuxmall.com, http://www.linux.org, or http://www.ssc.com/ (had to put a plug in for the sponsor of the excellent LG).


 Date: Tue, 8 Jul 1997 09:10:32 -0700
From: Robert Christ rchrist@mcis.washington.edu
Subject: Spam Counter Attack

In Linux Gazette #19 you say:
SPAM Counter Attack! If you'd like to have your voice heard regarding SPAM mail, why don't you consider writing a letter to your representative?

I would just like to add a counter point that I would prefer that my congress person not attempt to regulate any aspect of the net. I have the tools and skills to prevent spamming all by myself. Laws regulating behavior seems to set a dangerous precedent..

thanks for your time,
Rob


 Date: Sat, 5 Jul 1997 21:25:48 -0600 (MDT)
From: Michael J. Hammel mjhammel@csn.net
Subject: User-Level Driver For HP ScanJet 5p?
To: lersch@thene.informatik.uni-bonn.de

You asked about HP Scanjet 5P support in Linux. Check XVScan at http://tummy.com. It supports this scanner and is a commercial product.

If you're looking for drivers for other scanners check out my review of scanners in my Graphics Muse column in the March 1997 Linux Gazette (that is in issue 15) at http://www.ssc.com/lg/.

Hope this helps.
Michael J. Hammel


Date: Sat, 5 Jul 1997 21:21:08 -0600 (MDT)
To: smalenfant@cablevision.qc.ca
Subject: Problems with XFree86

You wrote to the Linux Gazette:

I'm a new user to Linux and the problem still XFree86! So then I tried to know want can I do to Linux community. In Issue #16, you said that the problem is not video card and is Monitor balancing. So why Windows 95 can have all these preset on monitor and Linux don't have? Why we can't use the stuff in the Microsoft Lib to transfer it into the database of XF86Setup or something like that. Cause that's real that the dotclock and all this is very scrambled! Why not just resolution and Virtual Refresh, that's all we need to know, the program could do the rest! We don't have to know what horizontal frequency and dotclock it is!

Answer: Xi Graphics AcceleratedX 3.1. It does pretty much what you're asking for here. See http://www.xi.com.

Michael J. Hammel


Date: Sat, 5 Jul 1997 21:18:18 -0600 (MDT)
To: dmandel@transport.com
Subject: CD Burners, Scanners, Digital Cameras, etc.

You asked the following in the July Linux Gazette:

1.Will a Sony CDU926S burner work with xcdroast? Don't know about this one, but I may have to find out soon. I'd like to create a CD full of graphics tools, but I've never tried to do anything like this before. If I do find info I'll probably write it up in my Graphics Muse column in the Gazette.

2. What is a good, but cheap flatbed scanner to use? (Good means 24 bit color and >= 300dpi optical resolution.) What software (in Linux) supports the scanner?

Answer: Check my March 1997 Graphics Muse column. I did a review of the scanners currently supported (at that time). A good place to look (which is listed in that issue of the Muse) is the SANE Project.

3.I can't afford one, but... Are there any 35mm slide scanners on the market with Linux support?

Answer:I haven't seen any announced yet. I get info like this alot due to my work with Graphics Tools for Linux, but so far no one has pointed out any web pages or ftp sites for such drivers.

4.And as long as I'm asking dumb questions... Does Linux have support for any digital cameras yet?

Answer:Don't waste your money on these just yet, even if a driver exists (I haven't seen one of these either). Even the vendors have been saying this technology is too new and they haven't established the "rules of the game" for standards or formats. Many are using ordinary JPEG formats, but getting the data to your PC is variable and depends on the makers choice of protocols, connectors and so forth.

Hope this helps a little.

-- Michael J. Hammel


Date: Sat, 5 Jul 1997 21:09:06 -0600 (MDT)
To: rpragana@acm.org
Subject: Interfacing Genius Color Page-CS Scanner

You asked about using your Genius Scanner with Linux. I don't know if a driver is available although in a survey of scanners I did for the Graphics Muse Column (March 1997, Issue 15) of the Linux Gazette there was info on the Genius GS-B105G, Genius GS4500 and probably the GS4000 and GS4500A. Also, there is work being done on generic scanner support for the GIMP and other Linux applications via the SANE project.

I suggest you either look for the author of the Genius scanners to see if support for your particular scanner is forthcoming (assuming yours is from the same manufacturer as his). You should also check with the SANE Project to see if they have any ideas. Both should have pointers on how to write drivers and get info the specs for that scanner if they don't already have it.

One other place to look is http://tummy.com. This is the site for XVScan, a front end to xv that primarily supports HP scanners. They can also write the driver for a fee. XVScan is a commercial product.

-- Michael J. Hammel


Date: Sat, 5 Jul 1997 20:56:53 -0600 (MDT)
To: cricci@cpiprogetti.it
Subject: Matrox Mystique support

You wrote to the Linux Gazette:

Is there a chance to correctly configure a Matrox Mystique with 4MB RAM under X or I must throw away it ?

Answer: Xi Graphics AcceleratedX 3.1. I use it with my Matrox Mystique with 4MB RAM. There is a slightly annoying effect you'll see when moving windows (sort of like snow on a TV screen) but its minor and I hardly notice it anymore. They know about it and are working on a fix.

-- Michael J. Hammel


 Date: Mon, 14 Jul 1997 13:51:38 -0400 (EDT)
From: Ade Bellini AdeBellini@aol.com
Subject: Re: *2+ Processing Thank you for your interest and help, i am most pleased to have had so many helpful replies, this just goes to show how many friendly and informed readers the Linux gazette has (? blatant plug for the LG !). I am sorry this reply is in the form of a "shotgun" approach, but i really couldn't reply individually to so many, but to all of you that mailed me -- MANY THANKS. I have "solved" 1/2 the problem - i rebuilt the kernel ( to install sound blaster support) and some how (G-D knows how !) i can now run on *2 cpu but only drawing the affects of 1 !. tur i ur tur as they say in Sweden ! (luck in bad luck !!!). Again thanks for the help and keep on hacking !: Yours ade. Ade Bellini


 Date: Sat, 19 Jul 1997 12:24:41 -0700 (MST)
From: Joel Hardy deeng@nwcdh.inficad.com
Subject: Descent 3 for Linux?

Linux has always been the perfect platform for games, it's just very few developers (id and Crack.com are the only two worth mentioning that I know of) know that. Interplay and Parallax are developing the third game in their Descent series, and they're accepting ideas, so I think the Linux community should inform them of the benefits of supporting a Linux version. There have already been several (last estimate I heard was 90) people who have suggested that they support Linux, and they probably will if they're convinced enough people would buy it, so if you're interested in having the best DOS game ported to Linux, see http://www.interplay.com/descent/ideas and suggest Linux support.

-- Joel Hardy


Published in Linux Gazette Issue 20, August 1997


[ TABLE OF 
CONTENTS ] [ FRONT 
PAGE ]  Next

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

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


More 2¢ Tips!


Send Linux Tips and Tricks to gazette@ssc.com


Contents:


Boot Information Display

Date: Wed, 2 Jul 1997 18:18:11 -0400
From: Jon Cox jcox@cx.tufts.edu

I saw an article in July's LG that talked about using watch as a better way to monitor ftp downloads -- there 's an even BETTER way: Check out ncftp. It works much like ftp, but shows a progress bar, estimates time to completion, and saves bookmarks of where you've been. I think ncftp is pretty standard on all distributions these days.

-Enjoy Jon


Consider Glimpse Instead of Grep

Date: Wed, 2 Jul 1997 18:18:11 -0400
From: Jon Cox jcox@cx.tufts.edu

While grep works as a tool for searching through a big directory tree for a string, it's pretty slow for this kind of thing & a much better tool exists --Glimpse. It even has an agrep-style stripped down regexp capability for doing "fuzzy search", and is astonishingly fast. Roughly speaking:
glimpse is to grep as
locate is to find

I believe the latest rpm version is glimpse-4.0-4.i386.rpm You can find it in any site that mirrors Red hat's contrib directory.

Enjoy!
-Jon


Copy

Date: Wed, 2 Jul 1997 18:18:11 -0400
From: Wim Jongman dblyuiam@xs4all.nl

I have hacked a helpful utility. Please have a look at it.

Regards,
Wim Jongman


Diald Remote Control


I have been a satisfied diald user for  quite some time. one of the things that were on my list of favorites was the possibility to activate the link from another location.  I have written a small shell script that waits for activity on my telephone line.

If activity  has been detected the script submits the ping utility which  causes diald to set up a link to my ISP.  If activity is detected from the inside (diald does the dialing) then the ping is also performed but there can be no harm in that.

My /etc/diald.conf looks like this:

mode cslip
connect /usr/local/bin/connect
device /dev/cua2
speed 115200
modem
lock
crtscts
local local.ip.ad.dres
remote ga.te.way.address
mtu 576
defaultroute
ip-up /usr/local/bin/getmail &
ip-down /usr/local/bin/waitmodem &
include /usr/lib/diald/standard.filter

The first time the link goes down, the program waitmodem is submitted. The script for /usr/local/bin/waitmodem is:

#!/bin/bash

# This script waits for data entering the modem. If data has arrived,
# then a host is pinged to allow diald to
# setup a connection (and you to telnet in.)

if test -f /var/locks/waitmodem
 then
 exit 0
   else
 touch /var/locks/waitmodem
 sleep 5
 read myvar < /dev/cua2
 ping -c 10 host.com > /dev/nul & > /dev/nul
 rm /var/locks/waitmodem
 exit 0
fi

If the diald decides to drop the link, the ip-down keyword activates the waitmodem script. This creates a lock in /var/lock(s) and sleeps for five seconds to allow the modem buffers to flush. Then the modem device is read and if activity occurs, the ping is submitted. Change the italic bits in the scripts. The lock is removed and diald dials out. This allows you to access your machine. I guess you have to have a static ip for it to be useful.

Regards,

Wim Jongman


A New Tool for Linux

Date: Wed, 2 Jul 1997 18:18:11 -0400
From: Jordi Sanfeliu mikaku@arrakis.es

hi !

This is my contribution to this beautiful gazette !! :))

tree is a simple tool that allows you to see the whole directory tree on your hard disk.

I think that is very cool, no?

#!/bin/sh
#         @(#) tree      1.1  30/11/95       by Jordi Sanfeliu
#                                         email: mikaku@arrakis.es
#
#         Initial version:  1.0  30/11/95
#         Next version   :  1.1  24/02/97   Now, with symbolic links
#
#         Tree is a tool for view the directory tree (obvious :-) )
#
search () {
   for dir in `echo *`
   do
      if [ -d $dir ] ; then
         zz=0
         while [ $zz != $deep ]
         do
            echo -n "|   "
            zz=`expr $zz + 1`
         done
         if [ -L $dir ] ; then
            echo "+---$dir" `ls -l $dir | sed 's/^.*'$dir' //'`
         else
            echo "+---$dir"
            cd $dir
            deep=`expr $deep + 1`
            search    # with recursivity ;-)
            numdirs=`expr $numdirs + 1`
         fi
      fi
   done
   cd ..
   if [ $deep ] ; then
      swfi=1
   fi
   deep=`expr $deep - 1`
}

# - Main -
if [ $# = 0 ] ; then
   cd `pwd`
else
   cd $1
fi
echo "Initial directory = `pwd`"
swfi=0
deep=0
numdirs=0
zz=0

while [ $swfi != 1 ]
do
   search
done
echo "Total directories = $numdirs"

Have fun !
Jordi


Hex Dump

Date: Wed, 18 Jun 1997 10:15:26 -0700
From: James Gilb p27451@am371.geg.mot.com

I liked your gawk solution to displaying hex data. Two things (which people have probably already pointed out to you).

  1. If you don't want similar lines to be replaced by * *, use the -v option to hexdump. From the man page:

    -v: The -v option causes hexdump to display all input data. Without the -v option, any number of groups of output lines, which would be identical to the immediately preceding group of output lines (except for the input offsets), are replaced with a line comprised of a single asterisk.

  2. In emacs, you can get a similar display using ESC-x hexl-mode. The output looks something like this:
    00000000: 01df 0007 30c3 8680 0000 334e 0000 00ff  ....0.....3N....
    00000010: 0048 1002 010b 0001 0000 1a90 0000 07e4  .H..............
    00000020: 0000 2724 0000 0758 0000 0200 0000 0000  ..'$...X........
    00000030: 0000 0760 0004 0002 0004 0004 0007 0005  ...`............
    00000040: 0003 0003 314c 0000 0000 0000 0000 0000  ....1L..........
    00000050: 0000 0000 0000 0000 0000 0000 2e70 6164  .............pad
    00000060: 0000 0000 0000 0000 0000 0000 0000 0014  ................
    00000070: 0000 01ec 0000 0000 0000 0000 0000 0000  ................
    00000080: 0000 0008 2e74 6578 7400 0000 0000 0200  .....text.......
    00000090: 0000 0200 0000 1a90 0000 0200 0000 2a98  ..............*.

    (I don't suppose it is surprising that emacs does this, after all, emacs is not just and editor, it is its own operating system.)


Hard Disk Duplication

Date: Tue, 24 Jun 1997 11:54:48 +0200
From: Jerko Golubovic jerko.golubovic@public.srce.hr

A comment on article "HARD DISK DUPLICATION" written by mcablec@ucsd.edu in Linux Gazette #18 (June 97).

What I did at my place is following:

I SetUp root-NFS system to boot usable configuration over network. I just need a floppy with appropriate kernel command-line and system brings up.

When system brings up I mount as /root NFS volume where I store compressed images. In that way I have them readily available when I log-in.

With dmesg I find about geometry of the hard disk of the target system. Then, for taking a new image I do:

cat /dev/hda | gzip -9 > <somename>.gz

And for restore:

zcat <somename>.gz > /dev/hda

Of course, I don't have to use such system. It is enough to prepare one boot floppy containing just FTP client and network config. I made two shell scripts:

b:
----------------------
#!/bin/sh
cat /dev/hda | gzip -9

r:
----------------------
#!/bin/sh
gzip -d > /dev/hda

Then, in FTP you do:

put |./b <somename>.gz            - to save image
get <somename.gz> |./r             - to restore image

ANY FTP server on ANY platform can be used for storage.

Not only that - you don't have to use FTP at all - you can use smbclient instead - and read directly from Win or Lanman shares - doing basically the same thing.


More on Grepping Files in a Directory Tree

Date:Tue, 1 Jul 1997 13:12:34
From: Gene Gotimer gotimer@cybercash.com

In Linux Gazette Issue 18, Earl Mitchell (earlm@Terayon.COM) suggested

 grep foo `find . -name \*.c -print`

as a way to grep files in a directory tree. He warned about a command line character limit (potentially 1024 characters).

Another way to accomplish this, without the character limit, is to use the xargs command:

find . -name '*.c' -print | xargs grep foo

The xargs command accepts arguments on standard input, and tacks them on the end of the specified command (after any supplied parameters).

You can specify where in the command xargs will place the arguments (rather than just on the end) if you use the -i option and a pair of curly braces wherever you want the substitution:

ls srcdir | xargs -i cp srcdir/{} destdir/{}

xargs has a number of options worth looking at, including -p to confirm each command as it is executed. See the man page.

-- Gene Gotimer


More on Hard Disk Duplication

Date: Mon, 23 Jun 1997 08:45:48 +0200
From: Jean-Philippe CIVADE jpcivade@cge-ol.fr

I've written an utility under Windows 95 able to copy from disk to disk in a biney way. It's called Disk2file. It's findable on my web site under tools. The primary purpose of this utility was to make iso images from a hard disk (proprietary file system) to record them on a cdrom. I've used it yesterday do duplicate a red hat 4.1 installed disk with success. The advantage of this method is this is possible to product a serial of disk very quickly. This utility is written to tranfert up to 10Mb /s. The duplication time for a 540 Mb is about 10 mins.

The way to use it is:

  1. start the program. Select scsi controller.
  2. Select a disk and a file where to put image file
  3. Select the source disk
  4. select disk2file mode and click "run"
  5. after completion, select the new disk where the image have to be written
  6. Select file2disk mode
  7. Click run

It's referenced as a shareware in the docs but I conced the freeware mode to the Linux community for disk duplication only.

-- Best Regards Jean-Philippe CIVADE


A Script to Update McAfee Virus

Date: Fri, 20 Jun 1997 00:05:33 -0500 (CDT)
From: Ralph ralphs@kyrandia.com

Here is a script I hacked together (trust me after you see it I'm sure you'll understand why this is my first script hack I'm sure) to ftp McAfee virus definitions unzip then and run a test to make sure they are ok...now ya gotta have vscan for linux located at ftp://ftp.mcafee.com/pub/antivirus/unix/linux

the first one does the work of pulling it down unzipping and testing

#!/bin/sh
# =====================================================================
# Name:         update-vscan
# Goal:         Auto-update McAfee's Virus Scan for Linux
# Who:          Ralph Sevy ralphs@kyrandia.com
# Date:         June 19 1997
# ----------------------------------------------------------------------
# Run this file on the 15th of each month to insure that the file gets
# downloaded
# ======================================================================
datafile=dat-`date +%y%m`.zip
mcafeed=/usr/local/lib/mcafee
ftp -n ftp.mcafee.com << !
user anonymous root@home.com
binary
cd /pub/antivirus/datfiles/2.x
get $datafile
quit
!
if [ -f $mcafeed/*.dat ]; then
        rm *.dat
fi
unzip $datafile *.DAT -d $mcafeed
for file in $(ls $mcafeed/*.DAT); do
        lconvert $mcafeed/*.DAT
done
uvscan $mcafeed/*
exit
---------------------------------------------------------------------------
CUT HERE

lconvert is a 3 line script I stole looking in the gazette

CUT HERE
--------------------------------------------------------------------------
#!/bin/tcsh
# script named lconvert
foreach i (*)
mv $1 `echo $1 | tr '[A-Z]' '[a-z]'`
-------------------------------------------------------------------------
CUT HERE

The last thing you want to do is add an entry to crontab to update your files once a month....I prefer the 15th as it makes sure I get the file (dunno really how to check for errors yet, its my next project)

# crontab command line
# update mcafee data files once a month on the 15th at 4am
* 4 15 * * /usr/local/bin/update-vscan

Its not pretty I'm sure, but it works

Ralph http://www.kyrandia.com/~ralphs


Handling Log Files

Date: Thu, 3 Jul 1997 11:13:56 -0400
From: Neil Schemenauer nas170@mail.usask.ca

I have seen a few people wondering what to do with log files that keep growing. The easy solution is to trim them using:

cat </dev/null >some_filename
The disadvantage to this method is that all your logged data is gone, not just the old stuff. Here is a shell script I use to prevent this problem.
#!/bin/sh
#
# usage: logroll [ -d <save directory> ] [ -s <size> ] <logfile>


# where to save old log files
SAVE_DIR=/var/log/roll

# how large should we allow files to grow before rolling them
SIZE=256k

while :
do
	case $1 in
	-d)
		SAVE_DIR=$2
		shift; shift;;
		
	-s)
		SIZE=$2
		shift;shift;;
	-h|-?)
		echo  "usage: logroll [ -d <save directory> ] [ -s <size> ] <logfile>"
		exit;;

	*)
		break;;
	esac
done

if [ $# -ne 1 ]
then
	echo  "usage: logroll [ -d <save directory> ] [ -s <size> ] <logfile>"
	exit 1
fi


if [ -z `find $1 -size +$SIZE -print` ]
then
	exit 0
fi

file=`basename $1`
if [ -f $SAVE_DIR/$file.gz ]
then
	/bin/mv $SAVE_DIR/$file.gz $SAVE_DIR/$file.old.gz
fi

/bin/mv $1 $SAVE_DIR/$file
/bin/gzip -f $SAVE_DIR/$file
# this last command assumes the PID of syslogd is stored like RedHat
# if this is not the case, "killall -HUP syslogd" should work
/bin/kill -HUP `cat /var/run/syslog.pid`
Save this script as /root/bin/logroll and add the following to your /etc/crontab:
# roll log files
30 02 * * * root /root/bin/logroll /var/log/log.smb
31 02 * * * root /root/bin/logroll /var/log/log.nmb
32 02 * * * root /root/bin/logroll /var/log/maillog
33 02 * * * root /root/bin/logroll /var/log/messages
34 02 * * * root /root/bin/logroll /var/log/secure
35 02 * * * root /root/bin/logroll /var/log/spooler
36 02 * * * root /root/bin/logroll /var/log/cron
38 02 * * * root /root/bin/logroll /var/log/kernel
Now forget about log files. The old log file is stored in /var/log/roll and gzipped to conserve space. You should have lots of old logging information if you have to track down a problem.

Neil


Exciting New Hint on xterm Titles

Date: Fri, 27 Jun 1997 15:43:44 +1000 (EST)
From: Damian Haslam damian@srsuna.shlrc.mq.edu.au

Hi, after searching (to no avail) for a way to display the currently executing process in the xterm on the xterm's title bar, I resorted to changing the source of bash2.0 to do what I wanted. from line 117 of eval.c in the source, add the lines marked with # (but don't include the #)

 117: if (read_command () == 0) 
 118:        { 
#119:          if (strcmp(get_string_value("TERM"),"xterm") == 0) { 
#120:            printf("^[]0;%s^G",make_command_string(global_command)); 
#121:            fflush(stdout); 
#122:          } 
#123: 
 124:          if (interactive_shell == 0 && read_but_dont_execute) 
.....
you can then set PROMPT_COMMAND to reset the xterm title to the pwd, or whatever takes your fancy.

cheers - damian


C Source with Line Numbers

Date: Sun, 29 Jun 1997 10:09:52 -0400 (EDT)
From: Tim Newsome drz@froody.bloke.com

Another way of getting a file numbered:

grep -n $ <filename>
-n
tells grep to number its output, and $ means end-of-line. Since every line in the file has an end (except possibly the last one) it'll stick a number in front of every line.

Tim


Another Reply to "What Packages Do I Need?"

Date: Wed, 02 Jul 1997 20:17:26 +0900
From: Matt Gushee matt@it.osha.sut.ac.jp

About getting rid of X components, Michael Hammel wrote that "...you still need to hang onto the X applications (/usr/X11R6/bin/*)." We-e-ll, I think that statement needs to be qualified. Although I'm in no sense an X-pert, I've poked around and found quite a few non-essential components: multiple versions of xclocks (wristwatches are more accurate and give your eyes a quick break). Xedit (just use a text-mode editor in an xterm). Fonts? I could be wrong, but I don't see any reason to have both 75 and 100dpi fonts; and some distributions include Chinese & Japanese fonts, which are BIG, and which not everyone needs. Anyway, poking around for bits and pieces you can delete may not be the best use of your time, but the point is that X seems to be packaged with a very broad brush. By the way, I run Red Hat, but I just installed the new (non-rpm) XFree86 3.3 distribution--and I notice that Red Hat packages many of the non-essential client programs in a separate contrib package, while the Xfree86 group puts them all in the main bin/ package.

Here's another, maybe better idea for freeing up disk space: do you have a.out shared libraries? If you run only recent software, you may not need them. I got rid of my a.out libs several months ago, and have installed dozens of programs since then, and only one needed a.out (and that one turned out not to have the features I needed anyway). Of course, I have the RedHat CD handy so I can reinstall them in a moment if I ever really need them.

That's my .02 .
--Matt Gushee


Grepping Files in a Tree with -exec

Date: Wed, 2 Jul 1997 09:46:33 -0400 (EDT)
From: Clayton L. Hynfield hynfiecl@mnemo.mcs.muohio.edu

Don't forget about find's -exec option:

find . -type f -exec grep foo {} \;

Clayton L. Hynfield


How Do You Un-Virtual a Virtual Screen?

Date: Mon, 07 Jul 97 15:08:39 +1000
From: Stuart Lamble lamble@yoyo.cc.monash.edu.au

With regards to changing the size of the X screen, I assume you're using XFree86. XFree will make your virtual screen size the larger of: *the specified virtual screen size *the _largest_ resolution you _might_ use with your video card (specified in 'Section "Screen"').

Open your XF86Config file in any text editor (ae, vi, emacs, jed, joe, ...) _as root_. (You need to be able to write it back out again.) Search for "Screen" (this is, IIRC, case insensitive, so for example, under vi, you'd type:

/[Ss][Cc][Rr][Ee][Ee][Nn]
yeah, yeah, I know there's some switch somewhere that makes the search case insensitive (or if there isn't, there _should_ be :), but I can't remember it offhand; I don't have much use for such a thing.)

You'll see something like:

Section "Screen"
    Driver      "accel"
    Device      "S3 Trio64V+ (generic)"
    Monitor     "My Monitor"
    Subsection "Display"
        Depth       8
        Modes       "1024x768" "800x600" "640x480"
        ViewPort    0 0
        Virtual     1024 768
    EndSubsection
    Subsection "Display"
        Depth       16
        Modes       "800x600" "640x480"
        ViewPort    0 0
        Virtual     800 600
    EndSubsection
    Subsection "Display"
        Depth       24
        Modes       "640x480"
        ViewPort    0 0
        Virtual     640 480
    EndSubsection
EndSection
(this is taken from a machine I use on occasion at work.)

The first thing to check is the lines starting with Virtual. If you want the virtual resolution to be the same as the screen size, it's easy to do - just get rid of the Virtual line, and it'll be set to the highest resolution listed in the relevant Modes line. (In this case, for 24bpp, it would be 640x480; at 16bpp, 800x600; at 8bpp, 1024x768.) Just be aware that if you've got a 1600x1200 mode at the relevant depth listed, the virtual screen size will stay at 1600x1200. You'd need to get rid of the higher resolution modes in this case.

I would strongly recommend you make a backup of your XF86Config file before you mess around with it, though. It's working at the moment; you want to keep it that way :-)

All of this is, of course, completely incorrect for MetroX, or any other commercial X server for Linux.

Cheers.


File Size Again...

Date: Sun, 6 Jul 1997 13:13:29 -0400 (EDT)
From: Tim Newsome drz@froody.bloke.com

Since nobody has mentioned it yet: procps (at least version 1.01) comes with a very useful utility named watch. You can give it a command line which it will execute every 2 seconds. So, to keep track of file size, all you really need is: watch ls -l filename Or if you're curious as to who's logged on: watch w You can change the interval with the -n flag, so to pop up a different fortune every 20 seconds, run: watch -n 20 fortune Tim


syslog Thing

Date: Fri, 04 Jul 1997 14:50:08 -0400
From: Ian Quick ian@dot.superaje.com

I don't know if this is very popular but my friend once told me a way to put your syslog messages on a virtual console. First make sure that you have the dev for what console you want. (I run RedHat 4.0 and they have them up tty12). Then edit your syslog.conf file and add *.* <put a few tabs for format> /dev/tty12. Reboot and TA DA! just hit alt-F12 and there are you messages logged to a console.

-Ian Quick


Ascii Problems with FTP

Date: Mon, 7 Jul 1997 15:59:39 -0600 (CST)
From: Terrence Martin twm139@missing.link.ca

This is a common problem that occurs with many of our Windows users when they upload html and perl cgi stuff to our web server.

The real fix for this has been available for years in ftp clients themselves. Every ftp client should have support for both 'Binary or type I' and 'Ascii or type 2' uploads/downloads. By selecting or toggling this option to Ascii mode (say in ws_ftp) the dos format text files are automagically translated to unix style without the ^M. Note you definitely do not want to transfer binary type files like apps or programs as this translation will corrupt them.

Regards
Terrence Martin


Running Squake from Inside X

Date: Fri, 11 Jul 1997 00:27:49 -0400
From: Joey Hess joey@kite.ml.org

I use X 99% of the time, and I was getting tired of the routine of CTRL-ALT-F1; log in; run squake; exit; switch back to X that I had to go through every time I wanted to run squake. So I decided to add an entry for squake to my fvwm menus. To make that work, I had to write a script, I hope someone else finds this useful, I call it runvc:

	#!/bin/sh
	# Run something on a VC, from X, and switch back to X when done.
	# GPL Joey Hess, Thu, 10 Jul 1997 23:27:08 -0400
	exec open -s -- sh -c "$* ; chvt `getvc`"
Now, I can just type runvc squake (or pick my fvwm menu entry that does the same) and instantly be playing squake, and as soon as I quit squake, I'm dumped back into X. Of course, it works equally well for any other program you need to run at the console.

Runvc is a one-liner, but it took me some time to get it working right, so here's an explanation of what's going on. First, the open -s command is used to switch to another virtual console (VC) and run a program. By default, it's going to switch to the next unused VC, which is probably VC 8 or 9. The -s has to be there to make open actually change to that console.

Next, the text after the -- is the command that open runs. I want open to run 2 commands, so I have to make a small shell script, and this is the sh -c "..." part. Inside the quotes, I place $*, which actually handles running squake or whatever program you told runvc to run.

Finally, we've run the command and nothing remains but to switch back to X. This is the hard part. If you're not in X, you can use something like open -w -s -- squake and open will run squake on a new VC, wait for it to exit, and then automatically switch back to the VC you ran it from. But if you try this from inside X, it just doesn't work. So I had to come up with another method to switch back to X. I found that the chvt command was able to switch back from the console to X, so I used it.

Chvt requires that you pass it the number of the VC to switch to. I could just hard code in the number of the VC that X runs on on my system, and do chvt 7, but this isn't portable, and I'd have to update the script if this ever changed. So I wrote a program named 'getvc' that prints out the current VC. Getvc is actually run first, before any of the rest of the runvc command line, because it's enclosed in backticks. So getvc prints out the number of the VC that X is running on and that value is stored, then the rest of the runvc command line gets run, and eventually that value is passed to chvt, which finally switches you back into X.

Well, that's all there is to runvc. Here's where you can get the programs used by it: