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

Clueless at the Prompt

By Mike List, troll@net-link.net

Welcome to installment 9 of Clueless at the Prompt:

Here's this month's account of the triumphs, trials and tribulations that I caused myself or encountered since the last time, and a couple tips that may come in handy and increase your understanding of linux.

*Changing Disks:

If you make partitions the same size as your previous disk's, you can simply hook up your new disk as slave(See the documentation that comes with your new drive, or sometimes there's a diagram on the top of the disk that shows jumper settings to configure the disk as master, slave, or only disk.), and use the "dd" command. You'll have to mount the old disk first, use fdisk to set the partitions to the desired size, then mount each partition separately, if you mount your partitions one at a time, you'll avoid having the whole old disk contents try to settle on your new disk.


If you have any serious need of any of the information on your old disk, I can't stress the value of periodic backups enough. Even if you just backup the configuration files you worked so hard to tweak to your liking, and maybe your checking account balance, anything that you don't have to remember or reinvent is a Good Thing(tm).

If you adopt the strategy of selective backups, you can easily fit them on a floppy or three, rather than using a whole tape or zipdisk to backup what you have already on your installation media. I think that especially if you installed from a CD, the plain vanilla install like you did the first time, can put you back on your feet when combined with a backup of only those files you wrote or modified, and and any special software that wasn't included in the distribution. To find out what files and libraries are required to run an app, you can use

    ldd filename

Another command that you can use to find out more about files is, strangely enough, file. File can be used as

    file filename

which will give information about other files, as well as executables. Yet one more helpful command is which, used like

   which executable

where executable is the command used to start the application as in

   which makewhatis

to find out where the executable is located, pretty handy if you are modifying your path statement.

*Oh did I mention backups?

I stress this because I know from experience that failing to backup your data is an extremely stupid and easy thing to do, but since I apart from the cardiac care unit and the nuclear reactor I don't have anything mission critical on my box right now, I'm still too lazy to back it up. Please excercise a little cautious computing if anyone's data needs to be secure

*A little bit about FVWM configuration files(fvwm-1.x):

with a little text editting, you can configure your Xdesktop to your liking. FVWM-2.x uses m4 macros, which I haven't even tried to acquaint myself with yet. FVWM is configurable in either system.fvwmrc or a .fvwmrc in your home directory, so you can set a consistent set of applications system-wide or change the defaults to your idea of a convenient desktop. Most of the possible modifications are explained in comments preceding the line to be editted or uncommented, and if you have X applications that aren't included in the default popups, all you have to do is follow the examples of those already there, usually something like
   Exec "PROGNAME"   exec progname -options &

the "&" causes the program to execute in the background, which keeps it from monopolizing X. Note that some apps, such as ImageMagick don't seem to want to share, and those will have to be exec'ed without the "&". Also non-X apps can usually be run by invoking an xterm or rxvt, in which case the titlebar can be changed to reflect the program name, as in

 Exec  "Top" exec color_xterm -font 7x14 -T Top -n Top -e top &

which starts a color_xterm running top. Top, in case you aren't familiar, basically lists the amount of resources each process is using. For more info type

    man top

or better yet just type


*Some stuff you may not hear anywhere else (so basic they forgot to tell you):

Redirecting output: you obviously can print a file to your monitor screen, and with a little luck even to a piece of paper via your printer, but did you know you can print a file to another VT or serial terminal or even to another file? By using the ">" or "<" symbols, you can do command line tricks that will impress your friends, cure male pattern baldness and hangovers, and make you irresistable to the opposite sex. Your mileage, as they say, may vary, unfortunately.

Some examples:

        cat filenamehere>>anotherfile

This one will add the contents of one file to another file, as in chapters 1 and 2 could be added together for reasons of continuity to make a fluid read that would otherwise be broken up by having to cat the successive chapters

        cat hellaracket.au >/dev/audio or /dev/dsp

is another example of redirecting the output of a command or file to somewhere other than standard output which is another way of saying your monitor.

Another feature is command line batching of commands. If you type several commands separated by semicolons, each command will execute when the previous one exits. A good example, is:

      make config; make dev; make clean; make zImage

which will perform each of the steps necessary to compile a kernel. As soon as the first command exits or is closed, the next one starts Any group of commands that you would like to run in succession can be done in this manner.

Another device you can use to your advantage with a little imagination is the pipe, signified by the "|" symbol. Pipe is a pretty good description of what it does, which is to "pipe" the output of one command into another command for further processing. One example that springs to mind is

    cat filename | pr -l56>/dev/lp0

which come to think of it, is another example of redirection as well. The above command takes the results of the cat command pipes it to a filter "pr", and redirects the output to /dev/lp0 to print a file in a reasonably attractive manner. For some of the options available to "pr", try

    man pr

This filter is particularly useful if you find lpr to be beyond your present capability, as I have :(. You should be aware however, that this will only work as root, or with a lot of permission hacking, which is probably best left undone, as it can cause security problems if /dev/lp0 is made available to regular users.

*That terminal finally works!! What worked:

If you have been reading this column for a while, you might recall I mentioned a vt 220 that I couldn't get working. I got impatient and got rid of it. but sometime later I ran into a wyse 150 and decided to try it again. This time I hit paydirt, thanks to a member of the Kalamazoo Linux Users Group, Scott Yellig. The magic bullet was the letter -L which was unreported in the serial HOWTO, but Scott is pree sharp at that stuff.When used in the /etc/inittab (Slackware) this line,
    s2:12345:respawn:/sbin/agetty -L 9600 ttyS1 vt100

if modified to reflect the serial port used, in this case com port 1 in DOS lingo. This line can also be used with a 8086 or above to emulate a serial terminal, if used with the proper cable. The proper cable, usually called a null modem, is often sold as a serial printer cable.

A serial terminal is a very good option when used with a Linux box as it allows more than one user on the system at a reasonable cost compared to buying another computer. The local university surplus disposal has them for about $25US, and you may find them for free. 8086, 8088, and 286 boxes, which will also serve the purpose can be gotten just as cheaply, depending on what hardware is attached. The other thing you need is a comm program, Minicom and Kermit are two that spring to mind or perhaps Seyon if you're in X. I've never used any of these programs to connect directly to another computer as a terminal without a modem, so I don't know much about connecting with minicom in this manner, but Kermit seems to be pretty simple in this capacity Another use is to kill frozen X applications. I had a Netscape bus error problem before I got Andreas Theofilu's nets , and a terminal can be used to kill out of control processes quite easily, by logging in and using kill or similar(remember die?)command to wax it and you can regain your X session. Nearly any non-graphical task you can do on the console can be done on a serial terminal. One exception, virtual terminals can be worked around to a degree by usingsplitvt which cuts your screen into two parts and by using

you can switch between the upper and lower displays, and work alternately between the two, with the added advantage of seeing both screens at once. You can even be root on one while using a different account on the other screen, easily cut and paste from one editting session to another, check top or ps or many administrative tasks that require monitoring. It ain't X but it's pretty good for a text only environment.

See you next month!

Previous "Clueless at the Prompt" Columns

Clueless at the Prompt #1 - February 1997
Clueless at the Prompt #2 - March 1997
Clueless at the Prompt #3 - April 1997
Clueless at the Prompt #4 - May 1997
Clueless at the Prompt #5 - June 1997
Clueless at the Prompt #6 - July 1997
Clueless at the Prompt #7 - September 1997
Clueless at the Prompt #8 - December 1997

Copyright © 1998, Mike List
Published in Issue 25 of Linux Gazette, February 1998