SLUG Pearls #4 For 25 Jun 2000

By Jeff Waugh

Check out the Sydney Linux User Group ( !

Table Of Contents


Welcome SLUGgers and Kernel Cousin readers!

This edition of SLUG Pearls is the first written for both our website, and Linuxcare's Kernel Cousins page. We hope readers far, far away from Sydney can enjoy the ongoing ramblings of our mailing list as much as we do.

Thanks aplenty to Terry Collins of Wombat Outdoor Adventures ( , who saved #1 and #3 with his copy of the SLUG mailbox.

- Jeff


1. No pussyfooting around

18 Jun 2000 - 19 Jun 2000 (7 posts) Archive Link: "split and join?"


We'll start off with a quick one this week: Ben Donohue had split a file for transfer on floppy with the split command, and found that join wasn't the command for joining the pieces back together.

DaZZa provided a quick and easy solution with "cat xaa xab > zzz" (cat is short for concatenate).

2. Superblocks found!

18 Jun 2000 (1 post) Archive Link: "Superblocks and lost mp3"

People: Simon Rumble

Simon Rumble kindly posted a solution ( to his problem ( from last week. The findsuper command allowed him to do an fsck on the partition, but the recovered files were a mess, if anything.

"No idea if these are recoverable but since I have a cable modem, recovering all these legal mp3s that I own the original CDs for shouldn't be a problem. Erm. ;)"

3. When Men are Men: Uptime

20 Jun 2000 - 22 Jun 2000 (10 posts) Archive Link: "9:52am up 368 days, 17:37, 1 user, load average: 1.02, 1.01, 1.00"

People: Ian WardHoward LowndesAravind NaiduAngus LeesConrad ParkerMatt AllenTony Cook

Someone has to start these things. Ian Ward:

What a great OS!

[root@gateway /root]# cat /etc/redhat-release
Red Hat Linux release 5.2 (Apollo)
[root@gateway /root]# uptime
9:52am up 368 days, 17:37, 1 user, load average: 1.02, 1.01, 1.00
[root@gateway /root]#

Howard Lowndes, seeing through the whole size of a man's... charade commented that, "You might be able to keep it up, but are you sure that you have got it properly covered. (8-)" Nyuk, nyuk, nyuk.

Matt Allen (who was too embarrased to show his uptime) wondered why Ian's load average was up at 1.00. Tony Cook (who didn't have a very good uptime, but felt obliged to tell) commented that his dual processor machine stays at 2.00 due to the obligatory client.

Aravind Naidu felt the need to blame someone else for his uptime, then standing at 262 days. Of course, "it would have been easily >400 odd days otherwise" .


[root@box /root]# uptime
10:21am up 396 days, 8:46, 1 user, load average: 0.09, 0.02, 0.01

Mine's bigger then yours. ;)

And then, "Here we go again..." Rodos:

[rodos@digit rodos]$ uptime
11:29am up 456 days, 4:43, 4 users, load average: 0.01, 0.08, 0.08
[rodos@digit rodos]$

Gus, one of our resident Debian Weenies (who also omitted his own uptime), commented: "heh, now try and upgrade it to the latest redhat - keeping the uptime (if thats too easy, do it remotely ;)"

Chiming in with veiled support, our president, Mr. Conrad Parker: "sheesh gus, next thing you'll be expecting people to do that in one command!"

Thanks Ian... ;)

4. The Distribution Question

20 Jun 2000 - 22 Jun 2000 (34 posts) Archive Link: "Distributions"

People: Jon BiddellTerry CollinsJim HagueAravind NaiduJim ClarkJeff WaughChuck D

There must be something in the water. Jon Biddell said, "Not wanting to start another Religious War (which this probably will), but who is using which distro for what ? What is "the best", if this can be quantified ?"

After a quick conversation, Terry Collins offered these tips:

If YOU are going to support the box, go with what you know best/find easiest.

If there is stiff resistance, go with something with the name, like, sigh, RedHat.

If you have a very specific job in mind, then ask on the list for people's experience with distro's and apps, e.g. network monitor, etc. It is usually the apps you want to know, rather than the distro,

Jeff Waugh posted a lengthy Debian recommendation ( , which Jon was interested in.

Jim Hague posted his personal guide:

Some quick recommendations included:

Thankfully, there were no flames directed at anyone on the list, but RedHat got a bit of a grilling, as per usual.

5. Bash Precedence

21 Jun 2000 - 22 Jun 2000 (5 posts) Archive Link: "bash"

People: Minh VanHerbert XuCameron Simpson

Minh Van posed a teaser:

given the expression:

1. if [ -n $dirname ] && [ \( -d $dirname \) -a \( -x $dirname \) ]; then

in bash, i don't understand why it is any different and less tedious from:

2. if [ -n $dirname ] && [ -d $dirname ] && [ -x $dirname ]; then

could somebody explain the reason or need to have embedded boolean constructs and escaped parentheses in the first expression ?

Herbert Xu:

Use the second form whenever you can. && is guaranteed to short circuit while -a never does. Also, to use -a safely you have to put in those ugly brackets :)

And if you shell doesn't have test built-in, well, dump it :)

Cameron Simposon disagreed: "Not so. They're only needed if you have precedence issues, which don't obtains in the examples cited."

Herbert gave an example showing why "it's a good habit to use &&/|| in place of -a/-o" :

Consider "$dirname" := "=", and we had

[ -d $dirname -a -x $dirname ]

Since = has the highest precedence among all operators, this becomes

[ \( -d = -a \) -d = ]

which causes an error.

This can be avoided by either using brackets or &&.

6. Machine Safety in the Workplace

21 Jun 2000 (1 post) Archive Link: "Look mum, no hands (writing)."


Rodos posted a helpful recipe for anyone using a single-purpose Linux machine in a hostile environment. A summary:

Well I have been trying to make a read-only system that in theory can't get a file system corruption.

I have a box that runs one application only. It is headless so if someone turns it off and on (likely, its in a factory mounted on a pilon) I want to be as sure as possible that it will restart without human intervention.

Here's how he did it. (

7. Don't Cache My Images!

24 Jun 2000 (4 posts) Archive Link: "Automatic update of html pages"

People: Matt Allen

Grahame Kelly's Wild Possum Cam ( was not being updated as the page refreshed, though he was using the correct meta tags. Matt Allen (who solves this one fairly regularly it seems), wrote:

Another solution is, if the page is being parsed by any sort of server side scripting, tack a unique number on the end of the grahpic, ie in PHP it would look like

<img src="images/blah.jpg?<?php echo time();?>">

That sould append the current unix time stamp on the end and ALL caches will reload it.

Its a good little trick to know.

Which worked perfectly.







Sharon And Joy

Kernel Traffic is grateful to be developed on a computer donated by Professor Greg Benson and Professor Allan Cruse in the Department of Computer Science at the University of San Francisco. This is the same department that invented FlashMob Computing. Kernel Traffic is hosted by the generous folks at All pages on this site are copyright their original authors, and distributed under the terms of the GNU General Public License version 2.0.