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


More 2¢ Tips!


Send Linux Tips and Tricks to gazette@ssc.com


Netscape 2c tip

Sat, 17 Jun 2000 09:36:15 -0400 (EDT)
From: Matthew Willis <matt@optimus.cee.cornell.edu>

You can get a two-column printout from netscape by using the psutils packages. For letter-sized printouts, just change your "Print Command" in netscape to

pstops -q -w8.5in -h11in -pletter "2:0L@0.7(8.in,-0.1in)+1L@0.7(8.in,4.95in)"  |  lpr -h

The PSUtils are avalable at http://www.dcs.ed.ac.uk/home/ajcd/psutils/index.html

You will have to edit the Makefile and set PAPER=letter if you live in North America.


Mandrake and memory

Mon, 26 Jun 2000 09:31:43 +0200
From: Martin Skjoldebrand <Martin.Skjoldebrand@forumsyd.se>

Here's something I stumbled across while installing Mandrake 7.1 this weekend. While the installer correctly detects that the machine has more than 64 MB RAM (in my case 128). However - it does _not_ adjust lilo or grub, which it installs as default.

So when you start up with manually editing the config files you only get 64 MB. Which may not be readily apparent (my 700 Mhz machine is like lightning even on 64 MB).

Naturally you may need to add "mem=8m" to your lilo or grub config file.

[See the Mailbag and 2-Cent Tips of the past few issues for a discussion of adding
append = "mem=128M"
to /etc/lilo.conf. Sometimes it's required and sometimes it isn't, depending on the BIOS. -Ed.]


vi and escape

Mon, 26 Jun 2000 18:11:14 +0200
From: JosX <joshb@xs4all.nl>

Hello gazette!

2-cent tip for new vi users: If you have to move your left-hand to hit all the time, you can give Control-[ a try (if you didn't notice this posibility already.)

bye


Intel i810

Mon, 26 Jun 2000 21:32:56 -0700 (PDT)
From: GregV <Kvgov@aol.com>
[Forwarded from The Answer Guy column. -Ed.]

Searching for more information about the i810 chipset I came across your [The Answer Guy's] discussion about it and Linux.

I had a similar problem with my Linux installation, where as Linux installed fine and I could utilize the command line wihtout a problem. However I had no graphics support, that is to say no XFree86.

The soultion to this porblem is to be found at support.intel.com, under the i810 fourm site. They have the X server and Kernel module and complete instrcutions for how to install and use the software. You must however read the fourm posts as there are a few tricks to the setup procedure.

That being said, I would like to know when/if kernel support will be provided for the i810 chipset. Actually I would rather learn how to find this information for myself. If you teach a man to fish, etc....


Tips in the following section are answers to questions printed in the Mail Bag column of previous issues.


ANSWER: Missing root password

Tue, 30 May 2000 21:47:43 -0400
From: Sean <snmjohnson@iclub.org>

Just use a boot floppy to boot up the machine into single user mode. >From there you can edit /etc/lilo.conf to your liking and run lilo, and also from there you can delete the encrypted password from either /etc/passwd or /etc/shadow (the latter if you're using shadow passwords). Then when you login as root, there will be no password, just hit enter. Be sure to immediately run passwd and give root a new password.

Pierre Abbat <phma@oltronics.net> writes:

Get a rescue disk like tomsrtbt, mount the root partition, and edit /etc/passwd manually, removing the root password or setting it to the same as on another computer (it's hashed). Then reboot using the boot disk you made when you installed Linux, log in as root, and edit /etc/lilo.conf and run lilo.


ANSWER: Limiting "Public Interfaces" on Share Libraries

Tue, 30 May 2000 23:56:27 -0400
From: Steven G. Johnson <stevenj@alum.mit.edu>

Hi, noticed your answer regarding "public interfaces" in shared libraries in the latest Linux Gazette, and I had a couple of comments. (I am a programmer, and have written several libraries and shared libraries under Linux.)

There are at least two good reasons to hide functions from public interfaces:

1) If a function is internal to the library, and it may well disappear or change incompatibly without warning in future versions, so that you don't want to be worry about people using it.

Any library will almost certainly contain a large number of such internal functions, and the code would be utterly unmaintainable if you couldn't change them between releases because people depended on them.

Of course, it is usually sufficient to simply not document those functions or declare them in your header files, so that programmers who find out about them should know that they use them at their own risk. (Some programmers are foolish enough to do so, even though it is almost never a good idea. e.g. there was a well-known case where StarOffice had depended upon internal glibc functions and therefore broke when glibc was upgraded.)

2) If you don't want to pollute the namespace.

If I have an internal function in my library called something generic, like print_error, I run the risk of accidentally conflicting with a function of the same name in a calling program, with unpredictable results. One way around this is to prefix the function with the name of my library, calling it e.g. foo_print_error if my library is libfoo. But this can be awkward to do for every little internal function you write, and it is often preferable to simply hide them from the linker.

There is a solution, however, provided by ANSI C: simply declare your functions with the "static" keyword, and they will only be visible/callable within the file they are defined in. This isn't perfect, I suppose, because they also aren't visible to other files in the same library. However, it covers the case where foo_ prefixes are most annoying: little utility functions that are only called within one file.


ANSWER: calculate cpu load

Wed, 31 May 2000 16:35:02 +0200
From: Ernst-Udo Wallenborn <wall@phys.chem.ethz.ch>
I would like to know how one can calculate cpu load and memory used by processes as shown by 'top' command. It would be nice if anyone can explain me how you could do these by writing your own programs, or by any other means.

In linux, a lot of information about the processes and the system in general is found in the /proc directory. To get the load average as output by top, use

cat /proc/loadavg

Information about the memory used by particular processes can be found in /proc//stat. Details on this are listed in the manpage of proc, cf. 'man 5 proc'.


ANSWER: Linux and the love bug

Wed, 31 May 2000 16:39:48 +0200
From: Vic Hartog <hartog@best.ms.philips.com>

Well, Alex's reply is partly right, but I *have* seen a 'lovebug.sh', so if you would allow your browser to execute it, it could do some damage. Maybe; I have not tried it. Assuming you are careful and do not read your email as 'root' the damage that the virus can do is limited. That's what file permissions are meant to accomplish.


ANSWER: resolution

Wed, 31 May 2000 12:06:01 -0400
From: Steven W. Orr <steveo@world.std.com>
My comuter under linux redhat xwindow will only run 300x200 graphics. Even if I hit CTRL ALT + , it wont change. I have a SiS620 Card with 8mb. Can you please help. I have spent a lot of time on the internet, It seems other people have the same problem but no one can help.

You need to properly configure your video card. Definitely easier said than done. You can run Xconfigurator, but I assume you've already done that. A few tips might help though.

* Instead of running startx, run startx 2>&1 | tee startx.txt This will tell you which modes were accepted and rejected by X at startup.

* Make *sure* that you tell Xconfigurator the proper values for your max and min horizontal and vertical scan rates. Using the defaults will yield the low performance figures you are probably getting now.

* There's a pretty good writeup on how to configure X in Running Linux from O'Reilly.

* A lot of the SiS cards are not standard. i.e., one card may be different from another card of the same model. The point is that if the card is properly configured, it still may not work. In that case, see if you can find yourself a good Matrox card. A Millenium II is cheap on e-bay these days and I consider it to be rock solid. That card probably came as a default in your PC. Don't feel bad; you had to buy a real modem too to replace that WinModem that came with it.


ANSWER: Getting the most from multiple X servers - using startx script

Sat, 03 Jun 2000 14:37:14 -0400
From: James Dahlgren <jdahlgren@netreach.net>

Bob Hepple's tip on using multiple X servers when using an XDMCP session manager was interesting and informative. I had never even heard of Xnest and it definitely looks worth investigating.

Personally I stay away from the XDMCP session managers. I like being able to use my computer without the overhead of a GUI, and I find the text mode easier on my eyes. I still end up using the GUI quite a bit and find times when running multiple X sessions, either using different bit depths and/or resolutions, or for different users, is desirable.

The default startx script from the RedHat distributions has display 0 hardcoded into it. I think this is the default script from the people who make X, but not being sure, this may not apply if you're not running RedHat.

There is a line in the startx script which reads:

display=:0

Replace it with:

let DISP=0
while ls -a /tmp/ | grep -q ".X$DISP-lock" ; do
        let DISP+=1
done
echo "Using Display:$DISP.0"
display=:$DISP

This checks the locks that X sets when it starts up, and uses the next available display. The echo line isn't needed, but I like feedback.

When an X session is running, use Ctl-Alt plus one of the Function keys to go to an available terminal, log in and run startx and a new X session will start. Use the Ctl-Alt Function key combinations to go back and forth between the various terminal and X sessions. You can even start a new X session by running startx from an xterm ( or equivalent ) from within X, but this makes the new X session a child of the original one, and when the first one is closed, it brings the second one down.


ANSWER: 300x200 graphics

05 Jun 2000 21:23:16 +0200
From: Guy "Iggy" Geens <ggeens@iname.com>

My comuter under linux redhat xwindow will only run 300x200 graphics. Even if I hit CTRL ALT + , it wont change. I have a SiS620 Card with 8mb. Can you please help. I have spent a lot of time on the internet, It seems other people have the same problem but no one can help.

Off-hand, I can think of two possible causes:

1. the "DontZoom" option is set 2. You have only configured the 300x200 resolution.

Both of these problems can be fixed by editing the XF86Config file. I don't use Red Hat myself, so I don't know exactly where it is. Normally, typing "locate XF86Config" should tell you the location.

Inside this file, you should look for:

Option "DontZoom"

If you find this, place a # in front of it.

If you don't find this line, it means your X server is set up to use only 300x200 as screen resolution. I think the best way to fix this, is to use Red Hat's X configuration tool, and to add the resolutions you want.


ANSWER: Energy star support

Thu, 8 Jun 2000 14:32:47 -0400
From: Pierre Abbat <phma@oltronics.net>

Last year I bought one of these cheap(er) east-asian PC computers (like many of us ?) with the Energy Star feature (i.e. No more need to press any button to power off).

But this feature is implemented with M$ Win... and I've no idea of the way they manage the hardware behind this process.

So, as I recently installed a Corel distribution, I would like to know if there is any mean to power off directly from Linux, and not Shutdown-And-Restart, Open-M$Windows and Quit-From-There (and Decrease-My-Coffee-Stock ;-} )

What is the LAST thing you see when you shut down your computer? It should be "System halted" or "Power down.". If it is "System halted", then auto-off is disabled in the kernel, and you need to recompile it. If it is "Power down.", but it doesn't, I'm not sure what the problem is, but I've seen it.

If it says "The system is halted", but does not then say "System halted" or "Power down.", something else is wrong. One of my computers crashes half the time, and hangs the other, on shutdown.


ANSWER: How to properly configure mail on home machines

Fri, 16 Jun 2000 13:59:39 -0400
From: Mark J Solomon <msolomon@nuomedia.com>

How to configure the typical home PC for mail services via your ISP? This information, though widely available, is not well-known. Many popular Linux books gloss over the subject, suggesting that Netscape (and Netscape alone) is the way to go. Unfortunately, this eliminates many fun, geeky, options like emacs' Rmail.

Most distibutions set up Sendmail and Fetchmail--but configure Sendmail for a "typical" host machine.

But a home user _can_ figure out how to modify this combination for home requirements without learning all of Sendmail. And it is relatively painless. My advice? Read the following short document thoroughly; and follow its instructions exactly http://www.linuxdoc.org/HOWTO/mini/Sendmail-Address-Rewrite.html

Then select the mail client of your choice and mail like the big guys!

Have Fun!


ANSWER: TOP Calculations

Sun, 25 Jun 2000 07:16:03 -0700
From: Mark Davis <chaos@glod.net>

Look at the files and directories under /proc. These are "virtual" files that are updated by the kernel. As I understand it, most programs that provide process info and the like merely decode and present info gleaned from the /proc files.


ANSWER: Success story (Was: DNS for home mail not working)

Mon, 26 Jun 2000 16:05:45 +0300
From: Alexandr Redko <redial@tsinet.ru>

Hello! My letter with a title "DNS for home mail not working" was printed in # 52 "Mail Bag". I appreciate the help and attention, but I believe that problem was really with my service provider. Because my request for help was ignored by provider we choosed another and installed the leased line. And here is success story. I laid the printouts of JC Pollman and Bill Mote articles before me, followed along - and all was working. Fetchmail got the mail from our mailboxes, procmail and imap delivered mail, sendmail handled outbound mail. Thank you, Linux Gazette, Mr. Pollman and Mr. Mote for my first linux success.


This page written and maintained by the Editor of the Linux Gazette. Copyright © 2000, gazette@ssc.com
Published in Issue 55 of Linux Gazette, July 2000