UNIX TIPS

by Fanel Donea (fdonea@yahoo.com)

The most recent version is at: http://fdonea.tripod.com/unixtips.htm

v.0.24, 11/06/2001

This is under permanent construction; many things are just sketchy because I didn't have time to complete them, but feel free to contact me if you want details. As a rule, the version number and date on top of this document change whenever I add a new question, but not when I make minor corrections.

The goal of this document is to try to make things a little smoother and easier for the user running Unix or Linux.

Disclaimer: I do not claim that the advice I give here is good or useful. Any typos are the sole responsability of my cat, who keeps interfering with my typing by sitting on the keyboard and blocking my view of the screen (on purpose, of course).

User-typed input commands and computer output are represented in typewriter font, with output further indented to the right.


Unix Tips

  1. * How to print big files doubleside easily without a proper duplex printer.
    Get and install the psutils package. Build the following shell aliases
    alias prepare 'psnup -2 \!* two_up.ps; \
    psselect -r -o two_up.ps odd_reversed.ps; \
    psselect -e two_up.ps even.ps'
    
    The backslashes are the line continuation characters for the shell. You don't need them if you put everything on one line in the shell resource file. Issue the command:
    prepare bigfile.ps
    
    To print doubleside, you print the odd pages first and then the even ones. Do it like this:
    1. print odd pages in reverse order (lpr odd_reversed.ps). Let the printer finish and stack the sheets in the output tray, do no shuffle the pages.
    2. Feed the half printed sheets to the input tray, without rotating, turning or shuffling them (just translate them)
    3. If on a network printer, cross your finger now and pray that no one sends another job to the printer :-)
    4. Now print the even pages (lpr even.ps). When the printer finishes, everything is hopefully printed doubleside.
    You can name the files first.ps and second.ps, to make it easier

    This assumes that you a have printer that stacks face up, like most HP Deskjets, for instance (if not, you'll figure out the right way to turn the pages after a little testing) It also assumes that your printer does not jam easily or feed two sheets at once (use quality paper or wait for the paper to flatten). If you are using a network printer, before printing the second time, open the tray so that printing is stopped and check the queue to make sure you are the first to print. If not, let the other users print first on empty sheets and add your paper later (you don't want your pages meessed up with other people's pages).

    If your file is not Postscript, you can use a conversion tool first to convert it to Postscript and then do the above. Another package useful for this and other printed-related jobs is mpage (currently distributed with Red Hat Linux and available on other platforms too). It can do double-sided printed in the manner described above (see the man page of mpage) and also supports duplex printers directly.

  2. * Can I print 2 small pages per physical page directly from Netscape under Unix? Yes, you can. The Print Message Box has a Print command entry which can be filled in with your preferred print command. As a command you can enter the name of a script that uses the procedure outlined above. This way, what you print from the WWW will reduce in size. My Print Message Box has the 'np2' print command entry. 'np2' is a simple shell script in my path, containing just this:
     mpage -2 -f -b A4 -H -m30l30r60t60b -Plp 
    You must have mpage installed, and in your search path, for this to work (lp is your printer name)
  3. * How can I get Netscape under Unix to print the URL on top or bottom of the printed page? BINGO!!!!! I don't know that!! I even wrote an E-mail to Netscape a few years ago, but got no reply. Please tell me if you find out. You can, of course, copy and paste the URL to standard input, after you type a printing command like nenscript with no arguments, but that's hard work and you often have to print an extra sheet. If I don't find out about it soon, I'll try to re-compile Netscape from source (possibly redistributing the patch, if GPL applies to Netscape too).
  4. * How do I print duplex 2 x A4R pages? Use mpage, mps and xlpr. I'll be back with details soon!
  5. * I live in a country where the national phone operator (say, RomTelecom) has been 'privatised' by being sold to the national (!) phone operator of Greece, and sometimes, exactly when the tariffs are low (!), the dialing tone is heard with big delays. How can I still connect to the Internet via dial-up?

    Method 1 (if you're lucky)
    Alter the value of the so-called 'S6 register' of your modem (yes, your modem has that) with the AT commands: ATDT S6=20 (tone) or ATDP S6=20 (pulse). That would make the modem wait for the dialing tone for 20 seconds. Larger values are possible, but not very useful, at least for me.

    Method 2 (the last resort)
    Use the PHONE to get the dialing tone first, then start the modem dialing and hang up the phone quickly as soon as the dialing tone gets echoed into the modem speaker.

  6. * I suspect my phone company (e.g. RomTelecom) is overcharging (see previous item) my Internet connections. How can I automatically measure costs? By the way, suspecting this myself, I have recorded time of day and duration for every single phone call and internet connection for 3 years (!!!) and found only minor differences on the bill (plus or minus 10 per cent, which I think is normal). I simply do not trust most people that claim they are being cheated, my guess would be that less than 1 per cent would write everything down as thouroughly as I did...don't believe that? Just mention the 3 years of painstaking list keeping to my wife, watch her reaction and you will !!! :-) But this has nothing to do with Unix...

    Anyway, if you connect to the internet via kppp in Linux, you can have every phone call to your provider recorded and converted to either currency (e.g. LEI) or units (e.g. IMPULSURI). It's easy to write a ruleset file for kppp that keeps track of different times of the day, different days, Saturdays, Sundays etc. Here's a version that does the job for you in Romania.

  7. * Trying to unmount the CDROM gives "...device busy". I know that this means that the CDROM directory is being accessed from one of my shells and that I should cd away from there, but which one is it? This is very annonying when you have a lot of terminal windows open or when the process that originally accessed the CDROM unexpectedly died. What we want to do in this case is to avoid having to close or check all the windows. The elegant (and fast!) way to do it is using the fuser command:
    fuser /mnt/cdrom/i386/
       /mnt/cdrom/i386/:     3170  3233  3467
    
    This will show you which processes are associated with reading the CDROM. You can now issue:
    ps -ef | grep 3170
    ps -ef | grep 3233
    
    to see the names of the applications and the tty number of the terminal they're running in, or, if that fails and you feel confident, you can even do:
    kill -9 3170  3233  3467
    
    Now you can unmount the CDROM (valid for other filesystems as well; e.g. floppies)

    If you have the lsof command (list open files) that could be useful too, especially in the more tricky case when you have quited every CD directory that has been accessed and still you cannot unmount the CD. Suppose for instance that you changed directory to the mount point of the CD-ROM (something like cd /mnt/cdrom) and launched an application from there (like xmixer &). Now because the initial working directory of xmixer was the CD mount point, this last directory is perceived as being in use by the umount command, and the message will be
    umount: /mnt/cdrom: device is busy.
    After you have cd-ed away from all CD-ROM directories, instead of wondering why on earth you cannot unmount the CD, just issue:
    lsof | grep cdrom
       xmixer    2192 fdonea  cwd    DIR      22,64    6144     79872 /mnt/cdrom
    
    The output line (second line above) clearly shows you the offending application (in this case xmixer). Quit that and you will be able to unmount your CD.

  8. * What's the easiest way to compare 2 text files?
    There are many utilities (diff, comm) but, by far, the best way in my opinion is to use kdiff and Midnight Commander, two excellent pieces of software. You must insert this in your ~/.mc/menu file:
    k       kdiff left_file right_file
            kdiff %d/%f %D/%F
    
    Now, when you press F2 and k in Midnight Commander, kdiff will be launched automatically, comparing the two current files from Midnight's panels. Isn't that great? (you must be under X-windows to do this) Of course, you could be using kdiff by itself, but then you will have to do the extra work of loading the two files (I prefer using the keyboard)
  9. * What's the easiest way to compare 2 directories?
    Try Midnight Commander's Ctrl-x-d command.
  10. * What's the easiest way to compare 2 directories RECURSIVELY?
    I wish Midnight Commander had some command for this, but you can easily adapt your own. Put this into your ~/.mc/menu file:
    r       Recursively compare directories
            cd %d
            find . -type f -print0 | xargs --null ls -l | cut -c33-1000 | sort -t. +1 > /tmp/00mc_current
            cd %D
            find . -type f -print0 | xargs --null ls -l | cut -c33-1000 | sort -t. +1 > /tmp/00mc_other
            kdiff /tmp/00mc_current /tmp/00mc_other
            rm -f /tmp/00mc_current /tmp/00mc_other
    
    Now, when you press F2 and 'r' the file listings of the directories in the two panels will appear inside kdiff. The script depends heavily on ls output format.
  11. * I have a remote Unix account in another country and reading a lot of mail over telnet with 'mail', 'mailx' etc is excruciatingly slow. They do NOT have POP3 or IMAP. How can I speed things up?
    Piece of cake! You can fetch your entire mail file via ftp and read it locally using the -f switch of many email readers or loading it as a folder in kmail or other menu-driven mail readers. This is a typical session:
    local% telnet remote.computer.etc
    ...
    remote% printenv MAIL
     /var/mail/user33                                         (to see mail file location)
    remote% cd /var/mail
    
    remote% ftp local.computer                                (open ftp to local computer)
    ...                                                       (give local username, pass)
    ftp> bin     
    200 Type set to I.                                        (mail may contain binary chars)
    ftp> put user33
    200 PORT command successful.
    150 Opening BINARY mode data connection for ...
    226 Transfer complete.
    local: user33 remote: user33
    1412735 bytes sent in 1.1e+02 seconds (12.80 Kbytes/s)
    bye                                                       (back to remote computer)
    
    remote% rm /var/mail/user33                               (remove your remote mail all at once)
    remote% mail
    No mail.                                                  (logical, isn't it?)
    remote% logout
    (Don't worry about completely removing your mail file; you will get further email;
    if you don't believe that, send yourself an email at user33@remote. Of course, you can
    also choose not to remove it and let it grow slowly...)
    
    
    local% mail -f user33
    
    And when you're done reading and sorting your email, you might consider using a .forward file, with your regular email address in it (don't forget the newline at the end, just in case, see one of the C-shell questions in this document).
  12. * My Linux partition is slowly filling up and I want to convert a Windows/NT/MSDOS partition (e.g. /dev/hda6) to Linux. How do I do that?
    Follow these steps:
    1. Use fdisk's 't' command to change the partition's type to 'Linux native'
    2. Make a Linux filesystem on it: mkfs -t ext2 /dev/hda6
    3. Add and entry for /dev/hda6 to /etc/fstab
       Use mount point: /aux, fsckorder: 2
    4. mkdir /aux
    5. reboot
    6. that's all!
    
  13. * I have a file, bigfile.tar which is 800MB uncompressed, and 500MB when compressed (bigfile.tar.gz). Now, none of my partitions has more than 300MB free. I need to read just a part of this archive, perhaps just a few files or a directory. Can I do that or do I have to buy a new hard disk?
    Better keep your money for something else. :-)

    First, let me point out that, given the above situation, Midnight Commander will not be able to read into the file, when you press Enter on bigfile.tar.gz, because it still needs space to store temporary files (probably the same amount of space needed when decompressing and de-tarring the file). Midnight Commander will just fill up the /tmp directory on the root partition and will finally fail with a 'disc full' message :-( So this does not solve the problem. Even worse, after trying and not succeeding, remember to go to /tmp and erase the big files that Midnight created and could no longer erase, because it ended in error.

    Luckily, there is a smart and relatively simple solution to this.
    First, if you don't have it already, generate a list of the files in the archive:
    gzip -c -d /mnt/cdrom/bigfile.tar.gz | tar -tv  > bigfile.list
    
    Now take a look at the resulting bigfile.list to see exactly what you need (in this example, I need to extract my entire PROG directory, fdonea/PROG).
    
    gzip -c -d /mnt/cdrom/bigfile.tar.gz | tar -xv fdonea/PROG
    
    

  14. * I have an old ISA network card that is not properly installed by the automatical installation procedure. How do I get it to work under Linux?
    Add a line like this to /etc/lilo.conf between the line with 'install...' and 'prompt':
    install ...
    append="ether=5,0x320,eth0"
    prompt
    
    and then run lilo and reboot. Use the same values for IRQ and IO that work in Windows (in the above example IRQ=5 in decimal, and IO=320 in hexa). What? You don't know them? But you did keep the specifications sheet, didn't you? If not, you might still have a chance by inspecting the card and the jumpers on it, sometimes there is a table showing jumper configurations, IROs and IOs drawn directly on the circuit board.
  15. * I have installed a RedHat Linux distribution from the CD-ROM of a computer magazine that also featured at least 100MB of other Windows software apart from Linux. Now, even though I followed instructions carefully, there's something that doesn't work!!!! (This is valid for some computer magazines in Romania) What can I do? First step: throw away the incomplete CD. Nowadays a serious Linux distribution like Red Hat 6.0-6.2 fills up 99 per cent of a 640MB CD-ROM, which means that the people that downsized the original distribution played God and removed packages more or less arbitrarily and, even worse, changed the installation procedure to give a 'personal touch' to the distribution. Get a real distribution, perhaps you can copy a CD from someone that downloaded the distribution from a reputable Internet source or even copy from original CDs (yes, it is allowed as long as you do it for personal use).
    I have personally had numerous headaches from trying to help people install or fix Linux on their PCs only to discover that they used weird CDs (some of them didn't tell me straight from the beginning!) Always prefer the original, or a good copy of it. It's worth the extra effort or money. The same goes for backup (it only shows how much you value your time or data).
  16. * What's the best book on shell programming? Well, the best I have seen is Unix Shell Programming, by Stephen Kochan and Patrick Wood, Hayden Books, 1990, Carmel, Indiana, USA, ISBN 0-672-48448-X
  17. * What's the best book on C ? Well, again, the best I have seen is Programming in ANSI C, by Stephen Kochan, Hayden Books, 1988, Indianapolis, Indiana, USA, ISBN 0-672-48408-0. A lot of people will recomend the language authors' book ( The C Programming Language, second edition, B.W.Kernighan and D.M.Ritchie, Prentice Hall, Englewood Cliffs, New Jersey, USA, 1988) but, even though that is a wonderful book to have for quick reference, I found Kochan's style much more to my taste. I wish he wrote a book on general relativity, too...
  18. * What's the best book on C++ ? You tell me...I simply found Stroustrup's book hard to read, but I may be wrong...or dumb... I have found an online introduction written by Marshall Brain (Understanding C++: An Accelerated Introduction) very useful if you know C already. You can find it at http://devcentral.iftech.com/learning/tutorials/c-cpp/cpp/
  19. * How do I define keyboard macros in Emacs, so that I type, say, F7 instead of {\^\i}? A little involved, but feasible... Use a ~/.emacs file in your home directory. Save and modify it, rather than retype!!! That particular example is the one I use for typing Romanian text in LaTeX, but you can adapt it so that F7 produces, say, ASADFSDERWFEAFAFASFAFAF when pressed.
  20. * Is there a simple way of typing in diacriticals in LaTeX? Sure! See the ~/.emacs file again.
  21. * How do I compile and use the PGPLOT graphics library with Linux RedHat 6.0 Follow these instructions.
  22. * How do I transfer files bigger than 1.4MB on floppies using Linux/Unix? There are simpler ways to do this, but by far the most universal is this:
    • Create a single big file using tar and compress it using gzip.
    • Split the file into smaller pieces using..you guessed it! ...split
           split -b 1400k bigfile.tar.gz       (for Linux)
           
      or maybe:
           split -10000 bigfile.tar.gz         (for Unix in general, or older split)
           
      With the second form (splitting based on occurence of newline character in a binary file), you may need to experiment a little with the parameter (-10000) in order to get decent sizes of the offspring-files.
    • Put the resulting xaa, xab, xac, ... files each on a floppy and go to the other computer and copy all the pieces in a directory.
    • If the destination computer is a Unix computer, then do this
           cat xaa xab xac xad  > bigfile.tar.gz
           
      If you have lots of small pieces, you may consider using shell wildcards:
           cat xa*  > bigfile.tar.gz
           
    • If the destination computer is a PC running Dos or Windows then, from a DOS-shell prompt do this:
         copy /b xaa + xab + xac > bigfile.zip
         
    If there were no errors when using either gzip -d, tar -x (destination Unix) or some kind of unzip (destination Windows) then you can be sure that the transfer procedure was ok.
  23. * How do I convert ASCII text that comes from DOS/Windows to Unix format and vice-versa? In adittion, I need the file time to be left unchanged! It's easy to do a 'tr' script or write a small piece of C code, but you should better use the GNU software 'recode', it does the job and keeps the file time intact.
    From Unix to DOS:
    recode lat1..ibmpc file.txt
    From DOS to Unix:
    recode ibmpc..lat1 file.txt
    No, the two dots are not a typo, that's just 'recode' syntax.

  24. * How do I format a floppy as an MSDOS floppy, from Linux? If you have mtools, insert the floppy and type:
    mformat a:
    
  25. * My Personal Best Software List The software mentioned here is what I consider to be the best for the given category (subject of course to my own finite knowledge of an ever growing realm). I do not claim objectivity, quite on the contrary, the list is heavily biased towards what I like. I do welcome other opinions about software that escaped my attention and supposedly does better in the 'Cons' area, I will give it a try if I did not already, but in the end...De gustibus.... Also, I'm only listing software that I can afford, i.e. free software.
    Category: Software name Pros Cons
    Email reader: kmail POP3, attach, folders, PGP, spell would not append to saved file, would not send email to 5 people at once (or I'm too dumb...tell me!); Also, inbox has to be emptied manually, otherwise, in the event of a forced termination, the entire (say, 200 email) inbox queue will be re-created
    New mail notifier: knewmail You can't miss new mail, you have to click a pop-up window to acknoledge, also uses sound card sometimes it only announces the first email
    diff tool: kdiff clear mouse only?
    File manager: Midnight Commander (mc) fast, 100 per cent keyboard, menus, time saving commands, compare directories, wonderful FTP file system and recursive retrieval, plus other goodies The shell goes bananas sometimes
    Simple X text editor: xedit very fast, arrow keys, X Window Copy and Paste No goto line, no macros, generally too simple...
    Powerful text editor: emacs macros, customizations, keyboard, more-than-an-editor is actually a better name for this software takes too many seconds to start
    Web file retriever (WWW robot): wget non-interactive, command line I'd rather have 'Partial content' files deleted
    CD MP3 extractor: grip works with cddb, converts CDs to MP3 with just a few mouse clicks  
    Multiple HTML file printer: htmldoc makes printing even hundreds of small HTML files a child's play (useful for printing FAQs, books etc from the WEB) It seems to load images into a memory list, so if you change or edit them you need to restart htmldoc (valid for the GUI version). Otherwise it will include the old graphics.
    Data entry application: xmbase-grok makes it very easy to add data to flat file databases, has highly customizable input forms. not relational, no SQL support

Unix and Linux Troubleshooting Guide

Or mini-guide rather...
This document tries to provide help for a specific kind of Linux problems, i.e. those that are close to causing you a mental breakdown and that typically have a simple if not trivial solution. They are (mostly) problems that bothered me too. They tend to appear after installing Linux, with the purpose of showing you that you don't know as much as you think you do :-)

E-mail me if you want more details about anyhting here.

  1. * I used to have Windows and Linux running smoothly on the same hard disk. Now, after reinstalling Windows, I can no longer boot my machine into Linux. How can I regain control? That's usually because Windows erases the MBR (Master Boot Record) of the disk, which is exactly where LILO puts its data.
    You can boot Linux if you insert the custom boot floppy that newer Red Hat installations advise you to do and reset the computer.
    If you don't have that, you can still use the installation floppy: insert it into the drive and reset the computer. At the installation prompt type:
    vmlinuz root=/dev/hda2
    
    or maybe:
    vmlinuz root=/dev/hda5
    
    The '/dev/hda2' thing is the partition that holds the root ('/') filesystem of the Linux OS. You may have to experiment with different numbers, if you don't know that (remember to take notes during the next installation, especially about disks and partitions). /dev/hda1 is usually the Windows partition (C). It changes a little when you have two physical hard disks inside the computer (/dev/hdb1 or /dev/hdc1, depending on where the CD-ROM is connected) Just try everything in turn and press Ctrl-Alt-Del as soon as you see the 'lovely' 'KERNEL PANIC' message.
    Once booting from floppy is solved (you got the login prompt), then you can proceed to the second step: log in as root and re-install LILO on the MBR (do that if LILO ran properly before the trouble started, otherwise you'll have to modify the /etc/lilo.conf file) by typing:
    /sbin/lilo
    
    Now everything should be as before. Remove the floppy and restart the computer.
    You can create an installation floppy from CD in Windows, by using the RAWRITE.EXE programme, giving it the name of one of the files in the /images directory as input. Everything you need is on the Red Hat CD.
    If you didn't do the custom boot floppy, and didn't keep the installation floppy, and also do not have a copy of the Linux CD, then you may consider the fact that there are other interesting things in life, apart from computers.....
  2. * How can a normal user use the CD-ROM and floppy? This used to be a problem in older RedHat distributions. Use the user option of the filesystem, in /etc/fstab. Here's an example:
    # device    mountpoint    filesystemtype    options            dump fsckorder
    
    /dev/hda5     /              ext2             defaults                    1   1
    /dev/hda7     /home          ext2             defaults                    1   2
    /dev/hda6     swap           swap             defaults                    0   0
    /dev/fd0      /mnt/floppy    msdos            noauto,rw,user              0   0
    /dev/fd0      /floppy_ext2   ext2             noauto,rw,user              0   0      
    /dev/hdb      /mnt/cdrom     iso9660          noauto,ro,user,unhide,exec  0   0
    /dev/hda1     /DOS           msdos            noauto,rw,user              0   0
    none          /proc          proc             defaults                    0   0
    
    This allows any user to read CD-ROMs, and to mount DOS or EXT2 floppies.

  3. * I cannot run an installation script from CD-ROM, even though permissions are right. It only works if I copy everything to hard disk. What's wrong? Your system does not allow you to execute programmes from CD-ROM file systems. Simply add the exec option to your cdrom filesystem in /etc/fstab.
  4. * I try to rlogin or telnet to a Linux computer and it just says "address already in use" or "connection closed". What happens?
    This weird thing:
    telnet 10.0.0.15
       Trying 10.0.0.15...
       Connected to 10.0.0.15.
       Escape character is '^]'.
       Connection closed by foreign host.
    
    ------ or, if I used rlogin instead:
    rlogin 10.0.0.15
       rcmd: 10.0.0.15: Address already in use
    
    happened to me when the destination computer was short of space on the root partition (/) and therefore refusing further connections from outside, among other things. The message you get is really weird. Check space on destination computer (use rpm -qa | more to eliminate unneeded packages on RedHat Linux)
  5. * I'm installing software and I get messages about missing libraries, even though the libraries are present. Why? Maybe you forgot to run ldconfig (after updating /etc/ld.so.conf by hand if your installation script didn't do that for you).
  6. * My C shell scripts sometimes inexplicably refuse to work correctly. Why?

    Check the script: you should have a newline as the last character in the script source file. If the newline is not there, the last line seems to be ignored, or the whole script runs weirdly. I currently do not know why this happens, please tell me if you do. I also do not understand why editors don't silently add newlines at the end of the file.

    Also watch for unneeded commands in the .cshrc initialization file, they too can affect the way scripts work (for instance, I kept a cd command in mine for years, before realizing that it was guilty of a lot of erratic script behaviour, especially about finding files and directories). If you really need to have such a commmand, keep it only in interactive shells, like this:
    # do a cd only in interactive shells
    if($?prompt) then
       cd
    endif
    

  7. * I have just recompiled the kernel and updated the kernel image in /boot. I could boot the new kernel from floppy, but not from hard disk: It just says "ran out of input data --- System halted". Why does it happen? You probably forgot to run lilo; you have to run lilo each time you change the kernel image, even though you do not change /etc/lilo.conf; BTW, you should always test your new kernel, while keeping the old one!! edit lilo.conf so that you can choose between kernels!! Here's a sample /etc/lilo.conf that does it:
    boot=/dev/hda                                                                                
    map=/boot/map                                                                                
    install=/boot/boot.b                                                                         
    prompt                                                                                       
    timeout=300                                                                                  
    default=l
    
    # linux, original kernel                                                                     
    image=/boot/vmlinuz-2.0.32                                                                   
            label=l                                                                              
            root=/dev/hda3                                                                       
            read-only                                                                            
    # linux, experimental kernel                                                                 
    image=/boot/vmlinuz.new                                                                      
            label=new                                                                            
            root=/dev/hda3                                                                       
            read-only                                                                            
    # windows 95                                                                                 
    other=/dev/hda1                                                                              
            label=w     
            table=/dev/hda                                                                       
    

  8. * Why doesn't Apache user access restriction work properly (the document is served without supplying the password and it shouldn't)? The password, though silently sent by the browser, is not required the second time from the user. Your access tests should be done opening new browsers each time (if there's only text I recommend lynx for that; it starts much faster)
  9. * There was a mess in /usr/src/linux, so I decided to erase the kernel sources and to install them again with rpm. Now, after trying to compile a kernel, I get error messages about missing *.h files (various files, according to what I select in make xconfig) and make exits with an error. What's wrong? If what you do is:
    make xconfig
    make dep
    make clean
    make
    
    and if you get error messages about missing *.h files, this means that, when you removed the kernel sources, you also removed important header files, which, for kernel compilation, need to be in /usr/src/linux or below that, rather than in the usual location (/usr/include etc). Try to remember, didn't rpm -e kernel-source say something about not being able to remove some files...and didn't you consequently try rm -f -r ?? They come in kernel-headers-xxx.rpm. You should check their integrity (or presence) with:
    rpm -V kernel-headers
    
    If files are reported missing, then do:
    rpm --force -ivh kernel-headers
    
    Remember to do rpm -Va once in a while....
  10. * I'm using Midnight Commander to compare files on hard disk with those on a MSDOS floppy. There are some files that simply refuse to be updated on the floppy: no matter how many times I overwrite them on the floppy, they are still reported as 'older' by 'Compare directories'. Why? How can I get rid of it? Even though there are things you can do about it, you will basically have to live with it! The MSDOS filesystem uses less bits to store file time (each file has a time associated, which is, in fact equal to the number of seconds since 1970.0). MSDOS files only have even seconds, while files on a Unix system can have odd AND even seconds. When copying an odd-second file from Unix to MSDOS, the extra second is stripped, and one second is lost from the file's time. This is why the file looks older when copied on the floppy. You can get around this and do a useful directory comparison in the following ways: (1) copy the floppy file back to hard disk; they will compare nicely now. (2) try to change the file's time on the hard disk to an even time (you have a 50% chance to succeed if you just save it again) or, if you don't like to loose the original file time, (3) use a short C program to strip the extra second from a file, without changing the time by more than a second. This is a possible way to do it in C. NOTE: When I say 'time' in Unix, I mean the time the file was last modified.

  11. * I have modified /etc/group but I still get errors, as if the groups were not changed. Should I reboot? That's not always necessary. Just close the already opened shells and open new ones (this worked on IRIX; for Linux I had to reboot, but maybe there is a faster way).
  12. * I have changed the configuration files of the WEB server (e.g. Apache), restarted the server (using kill -HUP ...), but there seems to be no change!! Why? Sometimes clearing the browser cache helps, try that too.
  13. * My cron job jobs do not work properly and I keep getting angry E-mails from cron One possible cause may be that cron does not like empty lines (this happened to me in IRIX 6.2, Linux is OK)
  14. * When printing from PGPLOT: I write the output of a program to a PostScript file and, when I send it to the printer, it never comes out. Also, when sending the output to a GIF files, the size of the file is zero. Why? You may have forgotten to end the PGPLOT session properly in the program (use pgend() or cpgend() ).
  15. * One and the same HTML file would work just fine when viewed locally but would not work properly when put on a WWW server. Why? Among other possible explanations, it happened to me that the two files were identical in content, but had different permissions (the one on the server did not have the necessary permissions). I did NOT get the 'forbidden' message from the WWW server, which is customary when permissions are wrong.
  16. * There seems to be little documentation about a specific piece of software in /usr/doc or in the programme Help menu, for a RedHat distribution. Where can I find more? You can obviously find more going to the original site where the program is kept and getting the sources. You don't need to do that if you also have the second CD from RedHat (SRPMs): due probably to space constraints many ASCII text and Postscript docs that come with the software are not copied to /usr/doc by the RedHat installation, but rather installed as info pages in /usr/info (maybe sometimes not even that, I'm not sure). But the second RedHat CD gives you everything!! It has been a nice experience to discover that some extremely useful manuals and examples are present on the second CD, it made the difference for me many times when I got stuck with existing information.
  17. * As root, I have changed my shell using chsh and now I can no longer log in ... This happened to me in Corel Linux, but it could happen in other systems, too. If you use chsh like this:
    chsh
    Changing shell for root [/bin/bash]: /bin/tcsh
    
    without first checking that: 1) tcsh is installed, 2) the path is correct then you might be in trouble. In the case of Corel Linux, tcsh is in /usr/bin/tcsh. Logins that try to execute /bin/tcsh will just die immediately! To fix this you could boot from floppy (you did make a boot floppy, didn't you?!) or, alternatively, find a way to edit /etc/passwd and manually change the shell field to a valid one.
  18. * I discovered suddenly that when I use new versions of RedHat (e.g. 6.0) I could no longer use key combinations like Shift-F5 (I used them as keyboard macros in Emacs and now I only get a bip instead of the special string of characters I want). How can I fix this? I do not know the complete and elegant answer to this but to get your key combinations back launch the GNOME Keyboard Applet (go to the task bar an do a 3rd button click somewhere between 2 icons and then: Add Applet | Utilities | GKB International Keyboard) and, under the Program button, change to Xmodmap (instead of xkb or whatever was there). I'll find a simpler way soon, I hope. Yes I know, xkb is newer software, but who gives new software the right to change my working configuration? The only thing a normal user cares about is to get his work done, not to boast about using the latest versions...
  19. * Using Midnight Commander, I get this message in a red dialog box when I try to run a command:
    'The shell is already running a command'
    How do I regain control?
    Type Ctrl-O and finish or erase any command waiting for completion in the background. Then Ctrl-O again. If this does not work, type Ctrl-O, then type clear in the shell, and finally Ctrl-O again. I usually do the clear thing directly.
  20. * Trying to view a *.doc file with F3 from Midnight Commander gives the error message: 'Empty output from child filter'. Why? Midnight Commander assumes your *.doc files are MS-Word files. That may not be the case with some old Unix files, dating fro pre-Microsoft history; they're simply ASCII text files. You need to press Shift-F3 to view them with Midnight (word2x needs to be properly installed, of course).
  21. * Nothing seems to work like in the manual pages with nice or renice. Why? You must be aware that some shells have internal versions of these commands, while the manual pages refer to Unix commands. Syntax may differ more or less, but sometimes that's just enough to drive you crazy or make you turn to Windows. To be sure you're running the Unix command which the man page documents, use the full path
    /usr/bin/nice ./a.out
    
    or whatever... Otherwise you may be running the shell's version of nice. You can use that one, of course, but in this case just type:
    man tcsh
    
    to see the syntax of the internal 'nice'. Have some wrist bandages and a new keyboard handy before trying this... :-)
  22. * I downloaded an ISO image from the internet, and the MD5 sum checked OK. I wrote the image on a CD and tried to re-create it using mkisofs. I do get the same file size but a DIFFERENT MD5 SUM!!! Why? Is my CD-writer defective? No, your CD-writer is probably ok. mkisofs includes the current date inside the ISO image, as a header (among other things). Therefore anything you create with it will not be the same in terms of CRCs and MD5s, even if you use the same system twice. But the actual file content should. I currently do not know how to persuade mkisofs to write a particular date inside the image (otherwise than editting a 600MB file by hand...).
  23. * I'm trying to uudecode a file and I get the error: "File too short". What's wrong? You should look at the first lines of the .uu file: there will be a 'begin' and then a file name. That name is the name of the new file that uudecode will try to create a a result of running it. If the original, encoded .uu file has the same name, then uudecode tries to put both the result and the input file in the same file (overwriting the input file is not always a good idea in Unix). Rename the initial .uu file to something else. This is actually a mistake of the person who did the encoding.
  24. * Whatever I try to do I get the message "...Stale NFS file handle." What's wrong? You're probably working on a NFS mounted partition and did not use the shell for some time. Meanwhile, using a different shell you have probably removed the very directory you were working in initially. Just 'cd' out of the now inexistent (or modified) directory and you'lll be able to use the first shell again.
  25. * My computer complains about too few colours, especially when I use any or more of Netscape, ghostview, xv. Also, some colours and characters don't show. Can I avoid this? Not entirely. You probably have a low colour, 8bpp display (for some old computers 8bpp is all you can get out of the graphics card). What you can do, especially about Netscape, is this: launch all vital application, like text editors, file managers etc first. This way they will grab the colours they need. Launch Netscape at the end. Netscape will probably complain and will also use dithering, or perhaps misrepresent colours a little, but it's better to have that rather than not being able to see what you type in your editor. You can also avoid the problem by launching netscape with a "private colour map" (Use netscape -install from the command line or insert that into graphical desktop launchers). This will ensure correct colours for Netscape and your application, but not simultaneously (it will depend on mouse cursor movement on the screen --- pretty annoying, though).

    With new computers, it may also be that your computer (i.e. graphics card, with 2-4MB or more of video memory) can do 24bpp (i.e. have true colour) but the default video mode is a failsafe 8bpp. With Linux you might try:
    startx -- -bpp 24
    
    or maybe
    startx -- -bpp 16 
    
    from the text mode login. If X Window starts automatically you can't do that, you need to start another X session with:
    Ctrl-Alt-F2to get a text mode login screen (just log in normally)
    startx -- :1 -bpp 16 and voila!...you have 16bpp
    When your're done, log out and close apps, kill your new X-session with Ctrl-Alt-Backspace, log out of the text mode screen, and type Ctrl-Alt-F7 to revert to the original X session.

    Many publicly funded institutions still have Unix computers bought not too long ago that can only do 8bpp. That's puzzling to me, since a Linux PC is usually faster, better and, of course, costs a lot less (Unix computers manufacturers are only too happy to have found a niche where competition is less tough because governments like to spend/misspend tax payer money on expensive equipment - hopefully this is changing now, with Linux and free/GNU software being the major players. And, by the way, NASA switched its Oracle databases to MySQL :-) :-) But that's another story...).

  26. * I'm installing software from source code in my own directory, via the classical configure-make-make install method. Everything is fine with ./configure and make, but when it comes to make install I get a lot of errors from install and installation stops half way. The errors are typically like: /usr/bin/install: /home/user33/bin/mc: Operation not permitted. Even the newest version of install behaves the same. What's wrong? Poor install is not to blame for this. That's not actually a usual install error message, it comes from the system. In fact, if you check, install does copy the file to the destination directory, it sets the permissions alright, but...there is a 'but', it does not set the group ownership of the file properly!!! That's it!! There you are!! Some of your directories' group ownership are not set to your default group id. This can happen with NFS mounted partitions. Apparently newer versions of install are fussy about this. You can remedy this yourself by doing something like
    chgrp -R group33 your_directory
    
    This will fix 'your_directory' and all the files inside it. You can also do it to your entire home directory. You don't know your default group id?? Just type id.
    Note: This happened to me on a Linux computer on which I was just a normal user (pretty awkward for me..) and I'm ashamed to confess that it took me quite a few days to figure it out :-( :-(

Questions Without Answers (Your help is needed)

I have personally found it hard or time-consuming to find a solution to the next problems that arise in using Unix or Linux. If you know a simple solution, please let me know! I'll mention your name here, of course.

So, I'm in search of simple solutions to the following: