More 2 Cent Tips & Tricks Issue 20

Rate this post

Send Linux Tips and Tricks to


lil2cent-6658172 Boot Information Display

Date: Wed, 2 Jul 1997 18:18:11 -0400
From: Jon Cox

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

lil2cent-6658172 Consider Glimpse Instead of Grep

Date: Wed, 2 Jul 1997 18:18:11 -0400
From: Jon Cox

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.


lil2cent-6658172 Diald Remote Control

Date: Wed, 2 Jul 1997 18:18:11 -0400
From: Wim Jongman

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

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
remote ga.te.way.address
mtu 576
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:


# 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
 exit 0
 touch /var/locks/waitmodem
 sleep 5
 read myvar < /dev/cua2
 ping -c 10 > /dev/nul & > /dev/nul
 rm /var/locks/waitmodem
 exit 0

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.


Wim Jongman

lil2cent-6658172 A New Tool for Linux

Date: Wed, 2 Jul 1997 18:18:11 -0400
From: Jordi Sanfeliu

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?

#         @(#) tree      1.1  30/11/95       by Jordi Sanfeliu
#                                         email:
#         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 *`
      if [ -d $dir ] ; then
         while [ $zz != $deep ]
            echo -n "|   "
            zz=`expr $zz + 1`
         if [ -L $dir ] ; then
            echo "+---$dir" `ls -l $dir | sed 's/^.*'$dir' //'`
            echo "+---$dir"
            cd $dir
            deep=`expr $deep + 1`
            search    # with recursivity ;-)
            numdirs=`expr $numdirs + 1`
   cd ..
   if [ $deep ] ; then
   deep=`expr $deep - 1`

# - Main -
if [ $# = 0 ] ; then
   cd `pwd`
   cd $1
echo "Initial directory = `pwd`"

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

Have fun !

lil2cent-6658172 Hex Dump

Date: Wed, 18 Jun 1997 10:15:26 -0700
From: James Gilb

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.)

Lire aussi...  Linux Remote-Boot mini-HOWTO: Configuring Remote-Boot Workstations with Red-Hat Linux, DOS, Windows 3.1 and Windows 95: The Configuration How-To

lil2cent-6658172 Hard Disk Duplication

Date: Tue, 24 Jun 1997 11:54:48 +0200
From: Jerko Golubovic

A comment on article « HARD DISK DUPLICATION » written by 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 > .gz

And for restore:

zcat .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:

cat /dev/hda | gzip -9

gzip -d > /dev/hda

Then, in FTP you do:

put |./b .gz            - to save image
get  |./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.

lil2cent-6658172 More on Grepping Files in a Directory Tree

Date:Tue, 1 Jul 1997 13:12:34
From: Gene Gotimer

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

lil2cent-6658172 More on Hard Disk Duplication

Date: Mon, 23 Jun 1997 08:45:48 +0200
From: Jean-Philippe CIVADE

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

lil2cent-6658172 A Script to Update McAfee Virus

Date: Fri, 20 Jun 1997 00:05:33 -0500 (CDT)
From: Ralph

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

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

# =====================================================================
# Name:         update-vscan
# Goal:         Auto-update McAfee's Virus Scan for Linux
# Who:          Ralph Sevy
# 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
ftp -n