March 1, 2004

CLI magic: say what, saytime

Bad news, buckaroos. I've recently learned that noobies will never venture outside the comfort and glamor of the GUI. The last thing they will ever do is to dabble in the CLI. That's a shame, too, because we were going to have a lot of fun this week stretching those noobie wings. The guy who told me is a real professional. He knows the Linux scene inside and out. How professional is he? Let me put it this way. He has professional sysadmins to advise him on things like noobies and the CLI. So it must be true. The bottom line is that if you are a certifiable sysadmin, or at the very least a power user, you may continue to read this column. Otherwise -- and I hate being the one to tell you this -- you can't read it. Because you don't really exist.

Say what?

An interesting question was recently asked in a comment to an earlier "CLI for noobies": why did I use the term "noobie" instead of "newbie?" The best answer I could think of was because in the initial piece I used the phrase "nattering noobies." To my eye, the double o of noobie was a better match for the double t of nattering. So what, you ask? That's a good question.

Here's a better question. Who is it, exactly, that I consider a noobie? Or asked another way, who is this column for? Here's the answer: it's for those who are new to Linux and want to learn a little something-something about the CLI, that's who. The term noobie doesn't reflect on your intelligence, experience level on other platforms, programming savvy, or mad admin skills. It only has to do with how long you've been using Linux. It applies equally to Aunt Nadine, who likes to put a comforter on her rodent during the winter, and to Ramon Fernandez, a semi-retired systems programmer, who tended to MVS et al on big iron for his bread, and who hacked a custom PC Bios so that his machine would boot Linux.

We don't go into the deep end on any topic covered in this column. It won't be covering topics that don't fit on an ordinary user's desktop. Apache config, MySQL installation, postfix or sendmail? Nope, not here. Real system admins and others more informed will cover those areas. Here, think Linux as a desktop OS, not Linux as a server. Think early experience, but don't think stupid, and don't think "they won't" or "they can't." You're selling both Linux and new Linux users short if you do. Now, let's get into the fun stuff. Let's prove that bumblebees really can fly.

Noobie beware

We're about to jump out of the GUI again, so fasten your safety belt. The object will be to install and run a program from the CLI. Note that this is not the recommended method of software installation. The very best way to install new software on a Linux system is to use the tools and the repositories provided with your distribution. If you're running Debian, that's apt-get and the official Debian repositories. If you're running Lindows, that's ClickNRun. For Mandrake, it's urpmi and for Red Hat it's up2date.

But occasionally you run into a need that can't be met by following that advice. Usually it happens when you want software not included in the recommended repository. That's why it's useful to know how to skin the cat a second way.

Buddy, can you spare Saytime?

Now let's prove that bumblebees really can fly. Start by grabbing this tarball off the Internet. Use your fave browser for the download, not the CLI.

Now open a terminal window so you can see the CLI. From there, enter the directory where you downloaded the tarball. You may already be in that directory if it's your home directory. The next step is to melt the tarball. Remember our old friend tar?

In the terminal window, type:

tar xzf saytime-1.0.tar.gz

Now enter the directory created by tar by typing:

cd saytime-1.0

Who was that masked user?

To install the program, we need permission (see Mother, may I? if you've forgotten about permission) to write to the /usr/bin, something which is verboten to normal users like you and I. Unless we know the secret spell, of course. To temporarily grant yourself superuser powers, type su at the command line, then hit enter. You'll be prompted for the root password. When you've entered that, you'll magically have been bestowed the keys to the kingdom.

Use them thusly to copy the saytime program to /usr/bin:

cp saytime /usr/bin

Now type "exit" to leave the magical kingdom where you are root and return to life as a normal user. One more thing to do and we'll be all set. We need to copy the mp3 sound files to our home directory. Do that by typing:

cp *.mp ~/

Once you've done that, type "cd" to return you to your home directory.

From your home directory, and still at the CLI, type "saytime" and hit Enter.

Pretty cool, huh? The saytime author has even included a simple command in the README file you can use to repeat the time announcement once a minute. Try this:

while true; do saytime; sleep 60; done &

Updated:
And hit Enter, of course. When you're tired of hearing the time announced once a minute, enter "fg" and then press CTL-C. That will halt the process.

OK, that's it for this week. Glad you beat the odds and stuck through it to the end. Or should I say, I would be glad. If you really existed.

Click Here!