More 2 Cent Tips & Tricks LG #33


Send Linux Tips and Tricks to gazette@ssc.com

Contents:

lil2cent-9438232 Newbie Help Redux (1)

Date: Tue, 01 Sep 1998 10:50:21 -0500
From: Mike Hammel, mjhammel@fastlane.net

Quick answers to get you started:

1. I have grown fat and lazy with Win 98 and find myself looking for « Display Properties » and such. I’m very familiar with C and such and am not afraid of hacking scripts or the like, but my problem is thus: Where is a (succinct) list of what gets run when, from where, and why. I’d love to tweak everything if only I could find it.

A. Take a look at /etc/rc or possibly /etc/rcX.d, where X is 1,2,3, etc. I don’t have RH5.1 but I think it uses the System V init system, so these directories should exist. If so, this is where you find the scripts that get run at boot time. For more details, you should look into the « init » tool. I suspsect this is covered in depth in some of the newer Linux system management texts. It’s not hard to understand, really. There are different run levels, and scripts for specific run levels get run at start up to get things going and again at shutdown to bring them down again.

2. I have something called an « Ensoniq Audio PCI » sound card with « legacy emulation » I don’t even know how to begin to get this thing working. What are the first steps in enabling hardware?

A. Commercial solution: http://www.4front-tech.com. This is a commercial sound driver but don’t fret – it’s only $20 and works like a champ right out of the box. I have it and have had zero problems. I’ve suggested it to a few other folks and they all seemed to like it too. There is a non-commercial version of this same set of drivers available for Linux too. But I punted on it when I heard about the commercial driver.

3. Where do I get information on mounting drives?

A. mount -t fat32 /mount_pt_dir or possibly mount -t vfat /mount_pt_dir. I don’t use MS on my box so can’t remember which one of these works with FAT32 partitiions but I’m fairly sure one of them does. In any case, other folks are likely to respond with more detailed answers on this one.

4. I think my printer works (at least text does), but how do I print things (man pages)?

A. xman will print the pages as postscript but you need to set up a print spooler using Ghostscript. A print spooler is just a locical printer name that accepts print requests, processes them with some filters and then feeds them to the printer of choice. Ghostscript will translate Postscript input into the printer command language for your printer. I keep forgetting where the Ghostscript FAQ (including download info) is at, but you can find it by searching on Yahoo. That’s what I always do.

The hard way to set up printers is to learn about configuring /etc/printcap. However, my RH4.2 system has a fairly decent printer configuration utility so I suspect 5.1 has an even better one. The bad news is I can’t remember the program’s name (it’s in my fvwm2rc at home and I never type it by hand). Check the documentation that came with the CD. I know it’s mentioned in there.

Best of luck.

Michael J. Hammel

lil2cent-9438232 Re: Help Wanted : newbie (2)

Date: Tue, 01 Sep 1998 07:37:43 +0200
From: « Anthony E. Greene », agreene@pobox.com

From: Dennis Lambert, opk@worldnet.att.net
I have grown fat and lazy with Win 98 and find myself looking for « Display Properties » and such. KDE (http://www.kde.org/) is supposed to be a more integrated desktop environment, and Gnome (http://www.gnome.org/) is coming along. I’m very familiar with C and such and am not afraid of hacking scripts or the like, but my problem is thus: Where is a (succinct) list of what gets run when, from where, and why. I’d love to tweak everything if only I could find it.

Linux is a complex OS, so the list isn’t succint. There’s a description of the boot process in the System Administrator’s Guide. If you’re new to Linux, I’d recommend you give the SAG a good browse. There’s *lots* of useful information there. You should have an HTML copy installed in /usr/doc/LDP/sag.

The Network Administrator’s Guide (/usr/doc/LDP/nag) is also good to have, but the HOWTO’s are better if you just need « cookbook » style docs. The HOWTO’s are in /usr/doc/HOWTO. You should fire up Midnight Commander (mc) from the command line and take a look around /usr/doc.

I have something called an « Ensoniq Audio PCI » sound card with « legacy emulation » I don’t even know how to begin to get this thing working. What are the first steps in enabling hardware?

There is a PCI-HOWTO and a Sound-HOWTO.

Where do I get information on mounting drives (FAT 32 especially)

In the Config-HOWTO or the archives of the Red Hat mailing lists.

I think my printer works (at least text does), but how do I print things (man pages)

Text and postscript are easy. Fortunately most things are convertable to postscript. In this case use:

 man -t CommandOrSubject | lpr

This is covered in the man page.

If you haven’t joined any of the Red Hat mailing lists, you might consider doing so. Be warned though; they tend to be busy lists (http://www.redhat.com/support/).

Welcome to Linux…

Tony

lil2cent-9438232 Clearing the Screen (1)

Date: Sat, 05 Sep 1998 11:56:53 -0700
From: Anthony Christopher, anthonyc@blarg.net

I have seen a lot of hints for restoring a trashed screen or window, but none of them mention the reset and clear commands. Are these commands deprecated, do they have unwanted side effects, or are they ineffective in certain situations?

When I have cat’ed an executable, I usually just type: reset and let the garbage scroll off the screen.

If, for some reason, I find the garbage characters annoying, I follow this command by typing: clear

Anthony Christopher

lil2cent-9438232 Re: simultaneous versions of kernels

Date: Fri, 4 Sep 1998 22:01:22 +0200
From: Henner Eisen, eis@baty.hanse.de

Just my 0.02 Euro:

Most of the installation problems are caused by interaction with the linux distribution’s default installation method. You can easily work around this by simply not installing your compiled kernel. Lilo and insmod support loading directly from the compilation directory.

Just unpack your kernel in an arbitrary directory, say /home/kernel/linux-test, apply any patches and compile: make [x|menu|old]config; make dep; make zImage modules. But do neither make install nor make modules_install.

Then add something like this to your /etc/lilo.conf:

 
# Linux bootable partition config begins
# test new (not installed) kernel just compiled in directory
# /home/kernel/linux-test.
image = /home/kernel/linux-test/arch/i386/boot/zImage
root = /dev/hda3
label = test
append= " MODPATH=/home/kernel/linux-test/modules/ "
# Linux bootable partition config ends
#

and run lilo whenever you have recompiled your kernel image.

When booting, choose « test » from the lilo prompt. The kernel will pass MODPATH to the environment of init and any startup routines that insmod’s kernel modules will fetch them automatically from the kernel compilation tree.

(If you additionally want to insmod some modules by hand from a root shell, MODPATH might be unset. But scripts can still extract that information from /proc/cmdline).

Henner

lil2cent-9438232 Question about your Linux Gazette post

Date: Fri, 4 Sep 1998 10:14:47 -0600 (MDT)
From: « Michael J. Hammel », mjhammel@fastlane.net

In a previous message, mjsendzi@engmail.uwaterloo.ca says: is there an url for this program?

No, not that I know of. A couple of people have asked this. It’s part of the core set of files in my Red Hat 4.2 distribution. Units has been around so long, and is available on so many different Unix platforms, that I suspect most distributions have a copy of it somewhere. On my RH4.2 it’s under /usr/bin.

 
mjhammel(ttyp2)$ type units
units is /usr/bin/units

mjhammel(ttyp0)$ units
501 units, 41 prefixes

You have: 3 miles
You want: kilometers
        * 4.828032
        / 0.20712373

Michael J. Hammel

lil2cent-9438232 COBOL Compilers for Linux

Date: Thu, 03 Sep 1998 22:54:19 -0500
From: cbbrowne@hex.net

Concerning the following, recently posted in Linux Gazette:

I have a friend who is doing a refresher course in Cobol in a Unix environment. I have suggested that she run Linux, and pick up a cheap / shareware copy of a Cobol compiler for Linux from somewhere. Knowing absolutely nothing about either Linux or Cobol, am I dreaming, or is there a realistic alternative to the compilers I have seen retailing for ~$1,500 US? I’d really appreciate any help/advice anyone can offer.

There are several possible COBOL options in the Linux realm; for details see:
http://www.hex.net/~cbbrowne/languages07.html

There’s not anything yet that could be considered 100% viable outside of (rather expensive) commercial options; obviously these sorts of things don’t happen without there being a population of people who are interested enough to be willing to invest the time necessary to implement something.

cbbrowne@hex.net

lil2cent-9438232 Resetting the term (2)

Date: Thu, 03 Sep 1998 16:44:25 -0700
From: david, david@kalifornia.com

You posted a program to reset your console should the text become garbled. I thought I would mention that most distributions, Slackware notably, come with such a program that does this and more.

reset will clear your tty, restore sane tty settings, and perform general tty cleanups. You should find this little utility just about anywhere 🙂

David

lil2cent-9438232 Re: Help Wanted : newbie (3)

Date: Wed, 2 Sep 1998 22:46:15 +0200 (CEST)
From: rsmith@xs4all.nl

In anwser to your questions in the September issue of the Linux Gazette:
I recently purchased Red Hat 5.1 and got it running. Evidently I was lucky in that I have a fairly full FAT 32 Win 98 drive and kind of stumbled through the defrag / fips / boot to CD / repartition / full install with LILO process. Everything worked, but I’m a little nonplussed. A few topics I’d absolutely love to get feedback on… Turns out I have a lousy WinModem. I can see the feedback now, (Run it over with your car)

Yep. Buy a *real* modem.

I have grown fat and lazy with Win 98 and find myself looking for « Display Properties » and such. I’m very familiar with C and such and am not afraid of hacking scripts or the like, but my problem is thus: Where is a (succinct) list of what gets run when, from where, and why. I’d love to tweak everything if only I could find it.

Daemons, boot time initialization: see the man page for `init’. There’ll be an assortiment of scripts in /etc/rc.d or /etc/init.d and /etc/rcX.d (where X = 0 to 6) that do your system’s boot-time setup.

For X, especially XFree86, you can fiddle with the XF86Config file, which should reside somewhere in /etc. Or if you have an X server running you can use `xvidtune’. The programs and window-manager started by the X server are usually in a file called xinitrc or xsession.

I have something called an « Ensoniq Audio PCI » sound card with « legacy emulation » I don’t even know how to begin to get this thing working. What are the first steps in enabling hardware?

You’ll probably need to compile a new kernel. The sound driver that comes with the kernel supports this card. install your distribution’s kernel source package, cd to /usr/src/linux and read the README.

Where do I get information on mounting drives (FAT 32 especially)

Read the manual for `mount’ and `umount’. Make sure you have a kernel with (V)FAT support compiled in.

I think my printer works (at least text does), but how do I print things (man pages)

Use the lpr program. It is a print spooler. You might want to fiddle with /etc/printcap to enable your printer to print PostScript (via GhostScript).

I’m not an idiot, not even a « dummy », but what is a good book to answer the basic questions? I have « Linux in a Nutshell » and it has a very good command reference and a few other things, but doesn’t help in tweaking things.

I haven’t read many books on Linux, just *lots* of manpages and HOWTO’s (in /usr/doc/HOWTO). Ask around in linux newsgroups.

I don’t really expect anyone to answer all of these concerns, but any little help would be greatly appreciated.

Hope this helps… 🙂

Roland

lil2cent-9438232 2c tip — more fun with pipes

Date: Wed, 2 Sep 1998 11:59:49 -0400
From: Larry Clapp, lclapp@iname.com

READ  Extensible Markup Language (XML)

After reading the « Un-tar as you download » 2-cent tip from scgmille@indiana.edu in issue 32, I thought you might like this, too.

Say you have a program with a large initial startup time. After that, the program reads a line from a file, processes it, reads the next line, processes it, etc, until EOF. You would like to process a single line of data without suffering through the initial startup each time. Try this:

 
    mkfifo input_fifo
    rm input_file
    touch input_file
    tail -f input_file >> input_fifo &
    long_program input_fifo &

When you want to feed it some data, say

 
    echo data1 data2 data3 >> input_file

The tail will wake up, read the line, output it to the fifo (aka « named pipe »), the program will wake up, read the data from the pipe, process it, and go back to sleep.

(You only have to do the mkfifo once; after that, it sticks around. On some systems (e.g. my Sun at work, where I came up with this), instead of mkfifo filename, use mknod filename p ».)

To shut things down, kill the tail. The program will get an EOF condition, and shut down normally.

Of course, a better solution might be to rewrite the program to read from stdin, and then say

 
    tail -f input_file | long_program -

but you can’t always do that. Also, neither of these ideas will work if the program reads the whole file, and then processes each line from an internal list.

— Larry Clapp

lil2cent-9438232 2 cents tip: Un-tar as you download

Date: Wed, 02 Sep 1998 03:46:20 -0700
From: Ben Collver, collver@dnc.net

tail -f –bytes=1m file-being-downloaded.tar.gz | tar -zxv
tail -f –bytes=1m file.tar.bz2 | bunzip2 – | tar -xv

I’ve noticed that sometimes tail -f does not work reliably. An alternative if you have lynx is:

 
lynx -source http://www.url.dum/file.tar.gz | tee file.tar.gz | tar zxm
lynx -source ftp://ftp.url.dum/file.tar.bz2 | tee file.tar.bz2 | bunzip2 - | tar xm

Ben

lil2cent-9438232 Re: Help Wanted: Looking for an Xwin Server software that runs under win95/nt

Date: Wed, 02 Sep 1998 11:31:08 +0100 (IST)
From: Caolan McNamara, Caolan.McNamara@ul.ie

From: Mark Inder, mark@tts.co.nz
We use a Red Hat 4.2 machine in our office as a communications server. This is running well with the facility oftelnet connections for maintenance, diald for PPP dial up – internet and email, and uucp for incoming mail. I would like to run an X server on my windows PC to be able to use X client software on the Linux PC over the local Ethernet. Does anyone know of a shareware for freeware version which is available.

Try the list at http://www.rahul.net/kenton/xsites.html#XMicrosoft

this one is free for example http://www.microimages.com/www/html/freestuf/mix/

Caolan

lil2cent-9438232 Re: Help wanted for a (Cheap) COBOL combiler for Linux

Date: Wed, 02 Sep 1998 11:27:20 +0100 (IST)
From: Caolan McNamara, Caolan.McNamara@ul.ie

From: Andrew Gates, andrewga@fcf.co.nz
I have a friend who is doing a refresher course in Cobol in a Unix environment. I have suggested that she run Linux, and pick up a cheap / shareware copy of a Cobol compiler for Linux from somewhere. Knowing absolutely nothing about either Linux or Cobol, am I dreaming, or is there a realistic alternative to the compilers I have seen retailing for $1,500 US? I’d really appreciate any help/advice anyone can offer.

I haven’t ever used Cobol, but at http://www.deskware.com/cobol/cobol.htm, there’s a Cobol for Linux under development for download (for free I believe). Might be good to check it out, and to find out if it’s of any use yet.

Caolan

lil2cent-9438232 Re: Clearing the Screen (3)

Date: Tue, 01 Sep 1998 19:00:31 -0700
From: « Mark J. Ramos », mjramos@sprintparanet.com

In the September issue you described some C code that can clear the screen when it gets screwed up from binary dumps to the terminal. There is a much easier way and it all it requires is the keyboard 😉 Simply type « echo control-v escape-c » where and hit enter. The « control-v » allows you to type in the « escape-c » literally.

This has worked much better for me then some other methods such as « reset » which comes with your favorite Linux distribution but like a compiler it isn’t always there. This key sequence is *always* available on an ANSI terminal.

Mark Ramos

lil2cent-9438232 Unix Tip

Date: Tue, 1 Sep 1998 20:01:31 -0400
From: Ian C. Blenk, eicblenke@Neurotic.Intermedia.Com

As an addendum to Allan Peda’s Tip in Linux Gazette issue 32, here is a quick tip that applies to most DEC emulators (vtXXX):

 
        echo ^V^O

That’s echo, control-V, control-O. The control-V portion escapes the control-O (terminal reset) from your shell. The echo just puts the control-O right back to your terminal emulator/dumb terminal (works great on true DEC terms too! 🙂

This works for most Unix flavors. No code. Easy to remember.

Ian Blenke

lil2cent-9438232 rc.local Tip

Date: Tue, 1 Sep 1998 14:24:07 -0700 (PDT) From: Creede Lambard, fearless@moosylvania.net

I’ve been reading the Linux Gazette for a couple of months now and I think it’s great, especially the tips.

Here’s one for you to consider that was inspired by Dennis Lambert’s « Help Wanted » letter in issue #32. I hope it doesn’t duplicate something you’ve already published.

To those of us used to the warm, fuzzy DOS world of CONFIG.SYS and AUTOEXEC.BAT, the complexities of the /etc/rc.d startup heirarchy can be nothing short of intimidating. Well, I decided to make it a little less so. I started by putting these lines at the top of /etc/rc.d/rc.local:

 
echo "==============================================="
echo " "
echo "Now running rc.local"
echo " "
echo "==============================================="

Now, when I start up Linux I can tell just when my local configuration starts to run, and if I’m having problems I can see whether they happen before or after rc.local starts. You can learn other things, too — I learned that rc.sysinit gets run on startup and shutdown!

Unfortunately, especially if you have a fast system, you can miss error messages as they scroll by and dmesg doesn’t always echo the information you need to solve a problem. I was seeing error messages in rc.local, but I couldn’t tell what they were because they went by too fast. So, I wrote a Perl one-liner:

 
perl -e "print 'Press ENTER to continue: '; $x = ;"

This prints a prompt, then waits for you to press ENTER before it continues. (Yes, there’s probably an easier way to do this with bash or some utility, but I already know Perl and I’m still learning bash. [grin]) By putting this at the bottom of rc.sysinit I made the boot-up sequence stop so I could see the error message, and of course once I saw it I knew exactly how to fix it. I comment out the line unless I need it, of course — if everything is working right I want Linux to take me straight to the login prompt!

Here’s hoping this helps someone.

Creede Lambard

lil2cent-9438232 Yet another method of resetting scrambled terminal after dumping binary data.

Date: Mon, 14 Sep 1998 03:55:54 +0000
From: Sang Kang, sang@mocha.dyn.ml.org

Perhaps this is the simplist solution:

 
        echo '\017'

that’s it.

Sang Woo Kang

lil2cent-9438232 Rick’s quick and dirty screen-saver

Date: Wed, 16 Sep 1998 09:10:04 -0400
From: « R. Smith », riter311@gte.net

Here’s a shell script which cycles through jpgs:

 
#!/bin/sh

# showjpg Rick's quick and dirty screen saver.

# Run from an xterm. Controll 'C' should get you out. Or run in
# background with '&' and use kill.

# forever
while [ 1 ]; do
# The path to your jpgs
  for file in /usr/local/images/jpg/*.jpg
  do
     xsetbg $file
     sleep 20
  done
done

xsetbg is from the xloadimage package. It’s the same as:

 
xloadimage -onroot -quiet

Sleep is in seconds. Use convert from the ImageMagick package to convert .gif or .bmp to .jpg.

Rick

lil2cent-9438232 MS Word & Netscape

Date: Tue, 15 Sep 1998 07:58:56 -0400
From: Vladislav Malyshkin, mal@mail1.nai.net

I wish to contribute 2 cents story.

One-click view of MSWord files in Netscape.

There is a sad fact, that some people use MSWord to exchange documents. When one one gets such file in a mail on Linux (s)he can use MSWordView, but this requires:

 
 Save file
 Convert from .doc to .html
 Start Netscape to view it

This 2 cents tip is about how to reconfigure netscape in order to view MSWord documents in one click.

To do this:

  • Download and install MSWordView from http://www.csn.ul.ie/~caolan/docs/MSWordView.html. Usually it takes just ./configure ; make ; make install
  • Edit file .mailcap in your home directory (create it if it does not exist). Add one line into this file:
     
    application/msword; ns="%s"\; nf="${ns}".html\; mswordview "${ns}" >"${nf}"\;\
     netscape -remote 'openURL(file:'"${nf}"')' \; sleep 2 \; rm "${nf}"
    

Vladislav

lil2cent-9438232 Pulling Files from NT

Date: Mon, 14 Sep 1998 23:29:10 +0000
From: Michael Burns, michaelburns@earthlink.net

Nothing groundbreaking here but, being a newbie to Linux and Samba I was having a difficult time getting Samba set up and needed to get some large files from an NT server to a Linux machine. I do not have any NFS programs for NT but do have a Web/FTP server running on NT so my temporary but quick solution was to put the files I needed into my NT server’s FTP directory and download them from there.

Michael Burns

lil2cent-9438232 Re: The wisdom of US West…

Date: Thu, 17 Sep 1998 19:30:16 -0600 (MDT)
From: « Michael J. Hammel », mjhammel@fastlane.net

Michael J. Hammel wrote: I haven’t checked, but doesn’t IPv6 have 6 dot-values? And are they larger than 8 bit values? Just curious. I haven’t heard much about IPv6 in awhile and wondered how we haven’t run out of IP space yet without it.

From: Jay Kominek, jay.kominek@colorado.edu
IPv6 addresses take the form of ‘FEDC:BA98:7654:3210:FEDC:BA98:7654:3210’ 8 16-bit hexadecimal chunks. All kinds of fun. Luckily, if you have a string of zeros in your address, you can do something like 1080::8:800:200C:417A

To save yourself some typing.

I hope I’m not running some place’s DNS when IPv6 becomes popularized.

Relevent RFCs:

  • 1883 Internet Protocol, Version 6 (IPv6) Specification. S. Deering & R. Hinden. December 1995. (Format: TXT=82089 bytes) (Status: PROPOSED STANDARD)
  • 1884 IP Version 6 Addressing Architecture. R. Hinden & S. Deering, Editors. December 1995. (Format: TXT=37860 bytes) (Obsoleted by RFC2373) (Status: PROPOSED STANDARD)
  • 1886 DNS Extensions to support IP version 6. S. Thomson & C. Huitema. December 1995. (Format: TXT=6424 bytes) (Status: PROPOSED STANDARD)

lil2cent-9438232 RE: Clearing the Screen (4)

Date: Wed, 23 Sep 1998 08:44:10 -0600
From: Robert Ferney, rferney@spillman.com

From: Allan Peda, allan@interport.net
A few days ago a classmate « accidentally » cat’ed a file to the screen. He asked asked me what he could do to reset his confused vt100, as clear wasn’t sufficient.

reset works very well for this. The command reset will effectively reset the screen by sending it the proper escape sequence. since reset looks up the escape sequence from the terminfo library so it works on just about any terminal. If this fails, sometimes a

 
$ stty sane

will do the trick.

lil2cent-9438232 Re: Keeping track of your config files

Date: Mon, 21 Sep 1998 22:30:58 +0200
From: Andreas

Your idea for keeping track of those files by linking them to a central directory is good.

Another idea I am using frequently is keeping track of the modifications by either employing SCCS or RCS (or whatever derived utility available).

Combining both ideas means for SCCS based systems: Use e.g.

 
    $ cd /
    $ sccs -d/root/SCCS create etc/inittab

if you share a lot of these files across several systems, but there are some files that may differ you probably like to type

 
    $ sccs -d/root/SCCS -p`hostname` create etc/lilo.conf

Which results in the following tree:

 
/root
|-/SCCS
|    |-etc
|    |     |-s.inittab
|    |     |-apollon
|    |     |     |-s.lilo.conf
|    |     |-jupiter
|    |     |     |-s.lilo.conf
    ...

For daily use I recommend to keep all the files ‘checked-out’, i.e. ‘sccs edit’ always after ‘sccs create’ and otherwise ‘sccs deledit’. The above commands should also be abbreviated by aliases.

For the RCS used admins I recommend ‘cvs’, but this means a bit more work ….

Andreas

Published in Linux Gazette Issue 33, October 1998

indexnew-8715034 homenew-1558560 back2-6274647 fwd-7228970

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