Issue #15 January 2006

Ask Shadowman

Merry New Year! Dear Readers, Shadowman wishes upon all of you a beautiful and wondrous 2006.

Or to Shadowman's Muslim friends: a fine Al-Hijra and a joyous upcoming 1427 to you.

Or to Shadowman's Chinese friends: Gung-Hay-Fat-Choy, and may 5766 be the Best. Year of the Dog. Ever.

Or to Shadowman's Jewish friends: hope that 4704 has been good to you so far, and apologies for once again failing to get those Rosh Hashanah cards out on time.

Shadowman's resolution for the new year: to answer every question that anyone ever submits to him. Except for the ones that are really hard.

Got a question that you'd like Shadowman to answer? Ask him.


Fokuran asked:

How we can find a text in a file that we dont know where it is.

To which Shadowman replies:

Ah, truly, it is grep that you seek.

grep stands for "Global Regular Expression Print" -- or maybe not -- and it's the screwdriver of the UNIX tool kit. Power users simply can't do without it.

The syntax is pretty simple:

grep text filename

Where text is what you're looking for, and filename is where you're looking for it.

Now, Fokuran doesn't quite know where this text is, exactly. No problem; grep allows you to specify a recursive search with the -r switch, and instead of a filename, we can specify a directory name, like so:

grep -r text directory-name

You might also be dealing with Issues Of Case Sensitivity, Which Can Make Finding A Line Of Text someWhat more DIFFICULT. No problem; grep allows you to ignore case with the -i switch, like so:

grep -ri text directory-name

But what if "text" happens to be in 500 different files? You don't want 500 filenames scrolling by. No problem; by using the pipe (that's this thing: --> | <--) and the less command in conjunction with grep, you can scroll up and down through the output at your leisure, like so:

grep -ri text directory-name | less

Even that can be hard on the eyes, though, and you might know that you're looking not only for "text", but also for "othertext" in close proximity. No problem; the pipe can also be used to run another grep on the output, like so:

grep -ri text directory-name | grep othertext

UNIX and Linux derive much of their power from small tools used in combination. A grep and a pipe together are strong as thunder. There's a whole world of other tools, though. Maybe the best ever book on this topic is the excellent UNIX Power Tools. It's a huge book, but well worth the price.

Be careful with your grep-fu, though, lest the novice misunderstand its power. An overenthusiastic spouse might ask you to "grep for all of the pretty pictures of us in our photo album." Which grep can't really do -- yet.

Beny asked:

Shadowman, I am trying to configure a cron job to use kppp to dial and connect to the internet, but it does not run. Is there an alternate, command line method to dial and connect to the internet?

To which Shadowman replies:

This sounds like a job for the Red Hat Knowledgebase!

What? You don't have access to the Red Hat Knowledgebase? That, sir, is a sin and a shame. But it doesn't need to be that way. Just go create a Red Hat account, and you'll be all set. No reason to persist in your ignorance.

Shadowman's Favorite Troll of the new year asked (sort of):

Gnome has always been inferior to KDE. Now, KDE is lightyears ahead of Gnome and there is little or no chance that Gnome will ever catch up. Qt is also superior to GTk in every aspect, just like KDE is to Gnome. Not to mention how ugly Gnome is and that KDE is the best looking desktop environment on the planet (which might not matter to some people, but it does to some). KDE's share of Linux desktops grows continuously and is now about 2/3s. I have always used only Red Hat distros, but I have also always been looking for a good alternative, because the gnomeness of Red Hat's distros is irritating. Whatever I tried, I would switch back to Red Hat, since the underlying infrastructure of Red Hat's distros (everything below GUI) has always been superior to anything else. I chose to tolerate gnomeness in exchange for peace of mind. It would be very nice if Red Hat's configuration tools would be rewritten based on KDE classes and if Red Hat would generally be more KDE-friendly. Any chance of that happening? One more question. A good frontend to yum would be nice. Yumex is not a good one. Any chance of something close to Synaptic ever emerging? Synaptic is just perfect. Yumex should have been a yum version of Synaptic.

To which Shadowman replies:

What an awe-inspiring piece of flamebait. Shadowman salutes you, and thanks you for the honest compliment paid amongst the stink bombs.

Flamebait or no, though, there's a good bit of truth in every inspired rant. Setting aside the relative merits of GNOME and KDE, it's no secret: Red Hat doesn't spend as much time in KDE-land as in GNOME-land.

So how to proceed? Well, lots of smart folks are thinking about it. Shadowman advises all dedicated KDE fanboys to join in the conversation.

But hey, what's this about Synaptic being "just perfect"? As you yourself state, Synaptic is a tool built on top of Gtk, which you have already stated to be "inferior to Qt in every aspect". How is it possible that a perfect tool can be developed on an inferior platform?

Shadowman casts you adrift in the terrible, crashing sea of your own logical fallacies! MU-wahahahahaha!

Next month: send your angriest "my X is better than your Y" emails to Shadowman. Shadowman solemnly promises to reply to the best one. The winner will receive absolutely nothing, as Shadowman is certain to take the opposing side of the question, and will therefore be in a righteous snit about the whole thing.