Linux Notes

This is a list of notes about problems and solutions I encountered while installing and running Linux on my computer.  The distributions that I have installed and worked with are Linux-Mandrake version 7.2 and 8.1, Red Hat Linux version 7.3 and 8.0, and Slackware Linux version 8.1 and 9.

What's Linux?

For those who aren't familiar with Linux, it's an operating system, like Microsoft Windows, except it's free.  It's free in two ways: it doesn't cost anything to download and use it, and the source code is not owned by a company like Microsoft.  That means that everyone is free to edit the operating system and write their own code and programs.  Unlike Windows, you can get Linux from more than one person/group, and two Linuxes might look and feel entirely different.  I use Slackware linux on my desktop PC, my home server, and my car stereo.  I have also used Mandrake linux and Red Hat linux, and this website is running on Debian linux.  Those are just a few of the many available distributions of Linux.

Table of Contents

Compiling the kernel - new, Sept 2003
Quick Commands
Installing Programs
Good Software
Mounting drives (or more correctly, partitions)
Recording CDs
Wireless Networking (WiFi)
Networking with Windows machines
Environment Variables / Paths
Process Management
File Sizes and Disk Space
Searching for Files
Jumping Mouse
Video Card / Display Issues
How to use the vi text editor
Random Other Stuff
Links to More Help


Quick Commands

Press Shift-PgUp or Down to scroll text on a console.

To make it nicer to work in the console, set the console to a different font:
setfont /usr/share/kbd/consolefonts/default8x9.psfu.gz
That sets it to a half-height font so you get twice as much vertically on the screen.  Note that 8x16 is the default.  [tested on Slackware 8.1]

To determine what version of RedHat Linux is running on a system, look in the file /etc/redhat-release.

Back to Top


Installing Programs

When you download/copy/otherwise-obtain a file that ends in tar.gz, you can extract that by typing tar -zxvf filename.tar.gz  .  Alternately, you can type gzip -d filename.tar.gz followed by tar -xf filename.tar  .

To install a program, you'll probably need to un-gzip and/or un-tar it... see the previous paragraph.  After that, you'll have a directory with the same name as the file you unzipped, minus the .tar.gz extension. Now cd to that directory with cd dirname and then type these commands, one at a time (note that each one could take a while):

        make test (or maybe make check)
        make install

If each of those commands returns to the prompt with no errors, then it's installed successfully.  You can then clean up a little by typing make clean and then make distclean  .


To run your newly installed program, look for an executeable file with the same name as the program, probably somewhere in /usr like /usr/bin or /usr/local/bin or even /usr/local/programname/bin sometimes.  You can double-click on that file to run the program.


To add your newly installed program to the "Applications Menu" or whatever you want to call it... first, look in the program folder (or the folder where you unpacked the files) for an icon file called programname.xpm or programname.png.  Copy this to /usr/share/icons   .  Now use MenuDrake (or your system's equivalent) to add the program wherever you want on the Application Menu.  You just need to specify the path to the program, and the icon for the shortcut.

Back to Top


Good Software

  • Enlightenment window manager... KDE and Gnome are fat and slow; Enlightenment isn't.

  • Adie text editor (here or here)... it's a really fast GUI editor.

  • ROX Filer file manager... it's really really fast, and highly configurable.

  • xsu lets you run an application as root, after it prompts you for the password.  Very handy.
Back to Top


Mounting drives (or more correctly, partitions)

If you install a new hard drive, or you simply have a hard drive installed that you can't access, here's how to "mount" the drive so that it's accessible via a directory.

First, run the fdisk command to see what partitions you have available.  For example, you might have a hard drive called /dev/hdb and that hard drive might have two partitions, /dev/hdb1 and /dev/hdb2.  Once you decide which partition you'd like to mount, you need to make a place to mount it.  This is just a directory, typically under /mnt.  So you could type mkdir /mnt/mypartition to create a place to mount your partition.  Now to mount, say, partition /dev/hdb2, use one of these commands:

mount -t msdos /dev/hdb2 /mnt/mypartition [to mount a fat32 partition]
mount -t vfat /dev/hdb2 /mnt/mypartition [to mount a fat32 partition with long filename support]
mount -t ext3 /dev/hdb2 /mnt/mypartition [to mount a linux partition]
mount -t iso9660 /dev/cdrom /mnt/cdrom

To make the partition mount automatically every time you boot, you need to add a line to your /etc/fstab file.  Here's what I added:

/dev/hdb2    /mnt/mypartition    vfat    defaults    0 2

defaults is probably good for most cases.  The 0 has to do with the dump command -- 0 says don't dump this filesystem.  The 2 tells Linux to check this partition for errors when the system crashes.  You can read more about these options hereNOTE: if you mount a FAT or FAT32 partition from /etc/fstab this way, only root will have access to the filesystem.  Instead, use defaults,umask=000 so that other users can access it.


Here's a quick way to remount a partition (to change its status, for example).  This will remount / in read-write mode; you could also use ro to remount it read-only:

mount -o remount,rw /
Back to Top


CD Recording / CD Writing / CD Burning

Here's how I managed to write a data CD on my linux system.  First, I followed the instructions here to set up SCSI emulation for my IDE CDR drive.  (Actually, on RedHat Linux 7.3, it was all already set up that way.)  CDRECORD WILL NOT WORK WITHOUT THIS SCSI EMULATION ENABLED.  Then, I read the manpage for mkisofs, which creates the ISO image for the files that you'll write to CD, and then I read the manpage for cdrecord, which records your CD from an ISO image.  All that reading led me to come up with these two commands (note that they're each one line, even though they "wrap" in the browser):

cdblocks=`mkisofs -print-size -quiet -J -r -V CDLabel -new-dir-mode 0777 -graft-points /path/on/new/CD/=/source/files/on/harddrive/`

mkisofs -V CDLabel -v -J -r -new-dir-mode 0777 -graft-points /path/on/new/CD/=/source/files/on/harddrive/|cdrecord -v -dev=0,0,0 -speed=16 -tsize=${cdblocks}s -eject -multi -

This worked perfectly, except for multisession writing.  It wrote the second session properly, and I can view it when I use a CDR program, but I can only view the first session through Konqueror / the ls command / Windows Explorer.

Note that you must run the "cdblocks=`mkisofs..." command first, even though you're just piping the iso to cdrecord in the second command.  That's because cdrecord (sometimes) needs to know the number of blocks before it starts writing the CD.  So that's why you see ${cdblocks} in the second command above.

Options: be sure to read man mkisofs and man cdrecord to see all the options.  There are many more than these ones that I used:

  • -print-size: this returns the number of blocks that the data will need to fit on the CD.
  • -quiet: disables all other output, so that the cdblocks variable holds only the number of blocks.
  • -J: write the CD using the Joliet filesystem.  This CD filesystem is used by MS Windows machines, and allows you to record filenames containing spaces and more than 31 characters.
  • -r: also write RockRidge filesystem information, so that the CD can be properly read in non-MS-Windows systems like Linux.  -r (unlike -R) also makes all the files on the CD freely readable (and executeable, where applicable) by everyone, rather than only by the person who wrote the CD.  This makes sense in most cases since usually you're writing a CD to be shared or used in other systems etc.  Use -R instead if you want to preserve permissions.
  • -V <label>: this is the CD label, like you'd see on the CDrom drive in MS Windows Explorer.
  • -new-dir-mode <nnnn>: sets the permissions for any graft-point directories that you write to the CD.  0777 is freely readable and executeable by everyone.
  • -graft-points /path/on/new/CD/=/source/files/on/harddrive/: This allows you to name the directories differently on the CD than they are named on the hard drive.  If you don't use -graft-points and if you delete the "/path/on/new/CD/=", so that you just have the source files listed, then those will be written to the root of the CD.  It will preserve the directory structure below, but not above, your deepest source directory.  So, in my graft-points example, a file named /source/files/on/harddrive/somefile.txt will be written to the CD as /path/on/new/CD/somefile.txt.  Without graft-points, it would be written to the root of the CD as somefile.txt.
  • -v: enables verbose mode (for both mkisofs and cdrecord)
  • -dev=0,0,0: this specifies your CDR drive to cdrecord.  Run cdrecord -scanbus to find the correct value for your device.
  • -speed=n: sets the record-speed (the "x" number) of your CDR drive.
  • -tsize=${cdblocks}s: recall the cdblocks variable that we set with the previous mkisofs command, and set tsize to that.  Note: I'm not sure what the "s" on the end is for, but it didn't work correctly without it.
  • -eject: ejects the CD after writing.
  • -multi: enables multi-session recording (i.e., doesn't close the disc after recording).  You probably usually don't want this option.
  • -: I'm not sure what the final dash does, but that's how this page did it, so that's what I did.
Back to Top



First, you need to make sure the driver for your network card loads. Edit /etc/conf.modules or /etc/modules.conf and add a line like alias eth0 8139too where 8139too is the driver for your network card.  (Another one of my systems has a D-Link DFE530TX card, and the driver name is via-rhine.)  If you already have a line with alias eth0 on it, then you should probably leave it alone.

On RedHat systems, the file /etc/sysconfig/network-scripts/ifcfg-eth0 contains network settings.  To configure your computer for DHCP (so that your router or ISP can give you a dynamic IP address), put this into that file:

If you're using a router or some other setup where you want to set your info manually, then your ifcfg-eth0 will look something like this:
After you've made those changes, run /etc/rc.d/init.d/network restart or just /sbin/service network restart to restart your network.  Running /sbin/ifconfig will show you your network configuration.

[ from ]


On Slackware systems, you set your IP address and gateway and/or DHCP info in the file /etc/rc.d/rc.inet1, and you execute that file (it's a script) to start your network card.  Or you can run the netconfig utility, which will set that all up for you.  Also, see the next question for more networking files.


How can I find my ip address in Linux?  To see your current IP address, run the ifconfig command and look at the entry for the device eth0 (assuming you're using a standard network connection; for wireless connections it'll probably be wlan0 instead).  Your Linux ip address and other networking configuration info are stored in a few key files:

RedHat systems:

Most other systems:

Additional files used by all systems:

Visit this page to learn more about these files.  Remember, after you edit them, you need to restart your network using one of these commands:

/etc/rc.d/init.d/network restart

Back to Top


Networking with Windows machines

To access a drive on your Windows PC from your Linux PC, you have two options.  If you want to temporarily gain access, you can use the mount command.  But you probably want to set it up so that you have permanent access (that comes back every time you boot), in which case you'll want to edit /etc/fstab.

Temporary access using mount:

Use the mount command, found in /bin. Note that this uses the smbmount command internally, so you don't need to mess with that directly. Also note that /mnt/windowsDrive is where you'll go to access your Windows drive, and you'll need to create that directory before running this mount command:

mount -t smbfs -o username=windowsUsername,password=yourPassword //windowsbox/c$ /mnt/windowsDrive

c$ is the Windows name for the c drive's "administrative share".  If you have another folder that you've shared explicitly in Windows, you can use that name instead, if you don't want the whole drive to be shared with Linux.

Note that you can add that line to your /home/username/.bashrc or /root/.bashrc file, which will execute the command every time you login, and every time you open a terminal.  There may be some rare instances where you'd want this behavior, but it's much more likely that you want permanent access to the drive using /etc/fstab.

Permanent access using /etc/fstab:

  1. Create a text file called /home/username/.cred by typing:

    vi /home/username/.cred

    This will open the vi editor so you can type into the file.  Press the i key so you can insert text, then type:


    Now press Esc, then type :wq to write the file and quit.

  2. At the shell prompt, type this to prevent anyone else from reading the file:

    chmod 600 /home/username/.cred

  3. At the shell, type su and when it asks, enter your root password.  Create a mount-point -- a directory, really -- for the windows drive (mkdir /mnt/win_c), then type:

    vi /etc/fstab

    Go to the bottom of the file, type o to make a new line, then type a line like this (note that it's all on one line):

    //windows-box/c$   /mnt/win_c   smbfs   credentials=/home/username/.cred,ro 0 0

    Or, to mount it so it's writable from the linux system, use this:

    //windows-box/c$   /mnt/win_c   smbfs   credentials=/home/username/.cred,rw,fmask=0777,dmask=0777 0 0

    Now press Esc, then type :wq to write the file and quit.  When you reboot, or run mount -a as root, this will connect to the c-share (c$) on the computer windows-box, and make it accessible on your Linux box at /mnt/win_c.  It will use samba to make the connection (smbfs), and use the login in your credentials file.  Note that the last two entries on the line are zeros, not capital-letter-Os.


If you're getting an error about "unregister_netdevice waiting for eth0 to become free", try this:

        ifconfig eth0 down   [ from ]

Then to bring it back up:

        /sbin/service network start


If you're getting messages/errors like this:

smb_trans2_request: result=-104, setting invalid
smb_retry: successful, new pid=738, generation=2

...don't worry.  That means that the network connection you're using has been idle too long, so the host disconnected.  The smb_retry line says that your Linux box automatically reconnected successfully.


To access a Linux drive from a Windows computer via Samba, here's what I did:

Install Samba.  This was partially installed on my Mandrake 8.1 setup, but for some reason it wasn't all there.  I used urpmi samba to install it, and 3 packages got installed.

Edit the file /etc/exports adding a line in the format Linuxmountpoint Windowshost(permissions)  .  For example, to allow my Windows computer named winbox to access /mnt/floppy , with read and write permissions, I add the line /mnt/floppy winbox(rw)  .

On the Windows machine, find the file called hosts somewhere under c:\windows and add a new line to it.  On the line, put the local IP address of, followed by the name of, your Linux computer.  For example, linuxbox  .

On the Linux machine, do the opposite.  Edit the file /etc/hosts and add a new line to it.  On the line, put the local IP address of, followed by the name of, your Windows computer.  For example, winbox  .  Now, you also want to identify your Linux box to itself in this file.  And, there should already be a line in this file defining the localhost name.  So when you're done, /etc/hosts should look like this: localhost.localdomain localhost linuxbox winbox

Now edit the file /etc/samba/lmhosts and add these lines, as silly as they may seem:

localhost linuxbox
winbox winbox

Next edit /etc/samba/smb.conf with the information about the folders you want to share.  Here's mine:

path = /sharedfolder
valid users = anthony
public = no
writable = yes

Also in /etc/samba/smb.conf you'll want to set the workgroup to the name of your Windows workgroup, so that the Linux computer will be visible in Windows' Network Neighborhood.

You'll probably also need to uncomment these lines in smb.conf:

encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd

Next I need to create an account within Samba corresponding to the "valid users" I listed above.  This command will create the proper entry in /etc/samba/smbpasswd (run it as root):

 smbpasswd -a anthony

Note that that user account must exist on your system.  You can use the adduser and groupadd commands to create the user if need be.

Finally, run the SMB daemon (that's what Samba is) with the command smbd  .  Or run it as root with /sbin/service smb start  . 

Now you should be all set.  You can run smbclient -L localhost to view the available shares on your Linux computer.  In Windows, go to the command prompt and type net use * \\linuxbox\sharedlinux , type the username and password that you specified earlier, and Windows will give you a drive letter to use with the shared Linux folder.

Back to Top



After editing your LILO boot configuration in /etc/lilo.conf, you may need to run the command /sbin/lilo -v (as root) to make the changes take effect.


I installed Gentoo 2005.1 on a system with a single IDE hard disk, with a single partition at /dev/hda1 that I intended to be both the root and the boot partition.  I was following the x86 quick-start guide which explained how to install the GRUB bootloader:

First put this into /boot/grub/grub.conf:

	default 0
	timeout 10

	# non-genkernel (no initrd):
	root (hd0,0)
	kernel /bzImage-2.6.12-gentoo-r6 root=/dev/hda1

Then copy /proc/mounts to /etc/mtab, and then run:

	grub-install /dev/hda

But this gave me an error: "Could not find device for /boot: Not found or not a block device."  I tried adding "/boot" to the kernel line in the config file, tried different arguments for grub-install, but no matter what it wouldn't work.

The way I finally got GRUB to install itself onto my hard disk's MBR was to change the kernel line in the config file to this:

	kernel /boot/bzImage-2.6.12-gentoo-r6 root=/dev/hda1

...and then run the grub command by itself, issuing these commands to it:

	# grub
	grub> root (hd0,0)
	grub> setup (hd0)
	grub> quit

After that, grub was able to properly boot my system.


When you boot Linux, you might come to a command prompt instead of automatically entering the graphical interface.  If so, you'll need to login, and then type startx to start the X-windows server.


To make my Linux box automatically log in, I followed the instructions on this page.  They are:

  1. Type this C program into a new text document (replace "username" with the user to log in):

    int main() {
        execlp( "login", "login", "-f", "username", 0);

  2. Save that as loginusername.c (again, replace "username" with the actual username) and compile it with gcc -o loginusername loginusername.c.  This will create the executeable file loginusername which you must copy to the /usr/local/sbin/ directory.  You'll need to be root to make the copy.

  3. Edit the file /etc/inittab and you'll see lines that look like 4:2345:respawn:/sbin/mingetty tty4.  (You may have getty, agetty, or some other getty in place of mingetty.)  Edit the line that looks like 1:2345:respawn...tty1, and change it to 1:2345:respawn:/sbin/mingetty -n -l /usr/local/sbin/loginusername 38400 tty1 .

Now your autologin is set. 


To run a program automatically on login, add it to the file /etc/rc.d/rc.local .


To see the messages that scroll by when you boot your Linux box, use the dmesg command.


To change the default runlevel of your system, edit /etc/inittab and look for the line id:4:initdefault:.  Change the number there to your desired runlevel.  You can change the runlevel from the command line by typing init n or telinit n where n is the desired runlevel.  Here are the descriptions of the different runlevels, taken from the /etc/inittab file on my RedHat box:

0 - halt
1 - Single user mode
2 - Multiuser, without NFS (The same as 3, if you do not have networking)
3 - Full multiuser mode
4 - unused
5 - X11
6 - reboot


To boot directly to a shell prompt, in case you need to fix or rescue or repair your linux system, hold down the left shift key at boot.  This will cause Lilo to let you type your own boot string.  (If you have Lilo configured to always make you type a boot string, then you don't have to hold down that key.)  So type linux rw init=/bin/bash (or replace bash with the shell of your choice, like maybe csh or ksh, etc).


The file /etc/rc.d/rc.modules (or possibly /etc/modules.conf or /etc/conf.modules, but those are deprecated) lists the modules that will be loaded on bootup.  For example, I added the line modprobe emu10k1 to this file to make my Creative Soundblaster Audigy soundcard work.  Well, I had to install the driver first... but I had to add that line to rc.modules to make the soundcard "start" whenever my system starts.


Here's how to back up your master boot record (MBR), from

You can make a backup copy of your existing mbr to floppy disc as a precaution. Put a formatted floppy in drive f0 and use the following command to copy the mbr from hard drive hda. (You must have root permissions.)

athlon:/home/chris# mount /floppy
athlon:/home/chris# dd if=/dev/hda of=/fd/MBR bs=512 count=1
athlon:/home/chris# umount /floppy

You can restore the mbr from the floppy using this command:

athlon:/home/chris# dd if=/fd/MBR of=/dev/hda bs=446 count=1

See /usr/share/doc/lilo/Manual.txt.gz for more details.
Back to Top


Process Management

The kill command lets you end a process if you know its process ID (pid).  But you can use the pidof command surrounded by backquotes (on the tilde key) to kill the process by name.  For example, to kill the smbd process:

kill -9 `pidof smbd`


killall smbd


Sometimes when you run a program from the terminal, you'll find that you don't return to the prompt unless you kill the program with a Ctrl+C.  To start a program and have it "detach" from the terminal so you get your prompt back, type the program name followed by a space and then an ampersand, like this:

        xfs &


To view running processes, use the ps command.  To view even more, use ps -ef  .   To view all processes whose commands contain the string "xfs", use ps -ef | grep xfs  .


To "pause a task" or "suspend a task", which is just pushing it to the background so you can have your terminal back, press control-z.  Then type jobs and you'll see your task there.  To bring it back to the foreground, type fg %N where N is the task number... and use bg %N to put it back in the background.


To configure services, like choosing which ones start at bootup, you can use the serviceconf, ntsysv, or chkconfig tools.  They manipulate the files in the /etc/xinetd.d directory and the /etc/rc.d directory. See this RedHat page for more info.


To assign keyboard shortcuts or macros (like Ctrl-Alt-Z) to launch applications:

  • Under KDE: use kmenuedit.
  • Under just plain X: use xbindkeys.
  • Under Enlightenment: edit the file /home/username/.enlightenment/keybindings.cfg and look for a section like:
        __KEY m
        __EVENT __KEY_PRESS
        __ACTION __A_EXEC /usr/local/bin/mozilla
    Copy and paste that to create another shortcut, with a different key and a different program for __A_EXEC.
Back to Top


File Sizes and Disk Space

To see how much space a directory is using, type:

               du /directory -c -h

That will list the size of the directory and all subdirectories, and at the very bottom of the listing, there will be a "grand total" for /directory .  The -c option enables the grand total, and the -h option causes the sizes to be in bytes instead of blocks.  You can also use -k or -m to put the sizes in kilobytes or megabytes.


To view the percentage of free space on a drive, use the df command (and use the -h option as above if you'd like).

Back to Top


Searching for Files

There are two simple ways to search for files or folders: find and locate.  Locate keeps a database of the files on your system, rather than actually searching the whole disk every time you do a search, so it's much faster than find.

find /path -name 'somefile'   (case sensitive)
find /path -iname 'somefile'   (case insensitive)
find /path -type f -print0|xargs -0 grep -il "sometext"   (displays files that CONTAIN the string "sometext"; note that's grep-L, not grep-ONE, and the Os are zeros)
locate 'somefile'   (case sensitive)
locate 'somefile' -i   (case insensitive)

Wildcards are allowed:

            ? matches any single character
            * matches any number of characters

The database of file and directory names used by locate needs to be updated regularly for it to be useful.  To update it, you must run (as root) locate -u or updatedb.

Back to Top


Environment Variables / Paths

To set an environment variable, type export VARIABLE="value" and to view the variables, type env or printenv .  To view just one variable, type echo $VARIABLE . To PERMANENTLY set an environment variable, add that export command to your login script.  For example, if you're using the Bourne Again SHell (BASH), then you'd add the command to the file /root/.bashrc (for the root account) or /home/username/.bashrc (for the username account).

To alter an environment variable without erasing the old value (for example, to append a directory to your $PATH), type export PATH=$PATH:/some/new/dir:/another/one:.


After installing glib, you try to install atk or pango (all available from, but you get errors about glib being missing.  Or, you get an error that says "pkg-config found glib version a.b.c, but we found version x.y.z installed."  What a nonsensical load of crap... this is why I freaking hate installing anything on Linux.  After about 19 million hours of wasted time, I arrived at a solution.  Run locate glib-2.0 and rename anything it finds to *.glib-2.0.*.crap.  Then re-run configure, make, and make-install for the new version of glib.  Then add the line /usr/local/lib to the top of the file /etc/ and then run the command ldconfig.  Now, if you're lucky, things might work.


For some installations, I got various errors until I added /usr/local/bin to my path.  You can append that to your path with this command:

        export PATH="$PATH:/usr/local/bin"

Back to Top


Jumping Mouse

Moved to here.

Back to Top


How to make the mouse wheel work

Here's how to make your mouse wheel work in linux, if it doesn't already.  You need to edit the file XF86Config or XF86Config-4, which will be at either /etc/X11/XF86Config(-4) or /usr/X11R6/lib/X11/XF86Config(-4).  And you need to be root to edit it.  Go to the mouse section and set the protocol to "IMPS/2".  Then make sure you have these lines:

Option "ZAxisMapping" "4 5"
Option "Buttons" "5"

Now just restart your X server and your mousewheel should work.  Or at least, it does for me.  My mouse is the "Microsoft Wheelmouse Optical USB and PS/2 Compatible" mouse, and when I run /usr/sbin/mouseconfig, I choose "Microsoft Intellimouse PS/2" and I do NOT emulate 3 buttons.

Video Card / Display Issues

You can change your video options via the XF86Config file.  The XF86Config-4 file is used by XFree86 version 4.x and the XF86Config file is used by XFree86 version 3.x. You'll need to edit the appropriate one depending on which version of the Xserver you're using. Check the video options in the Makdrake Control Center (or your system's equivalent control panel)... when you configure your video card there, it should ask you which version of the Xserver (3.x or 4.x) you want to use.  Pick one.

Once you know the version you're using, open /etc/X11/XF86Config or /etc/X11/XF86Config-4 (there's a slight chance the file could be in a different location; type man XF86Config to see where else it might be).

My monitor (a 19" KDS VS-195e) has a slight but noticeable flicker at any vertical refresh rate other than about 60Hz. So I needed to set this value manually. In the XF86Config-4 file's "Monitor section", I changed VertRefresh from 50.0-120.0 to 59.0-61.0 (Hz), and the Horizontal scan rate is 28-95kHz.

I also wanted to increase my resolution. I know you can do this through various control panels, but they don't always work, or the settings sometimes don't stick. So, I open XF86Config-4 and go to the "Screen sections". This section contains a bunch of ' Subsection "Display" ' listings. The first ' Subsection "Display" ' that works is the one Linux will use, so I needed to make changes to the first one, or add a new one before the first one. In my case, I just added "1024x768" (with the quotes) before "800x600" on the Modes line.

    Subsection "Display"
        Depth 16
        Modes "1024x768" "800x600" "640x480"
        ViewPort 0 0

Then I pressed Ctrl+Alt+Backspace to restart the Xserver (which is basically like logging out). When I logged in again, I was running at 1024x768@60Hz.


You can cycle through your available display modes by pressing Ctrl+Alt+KeypadPlus or Ctrl+Alt+KeypadMinus.


You can change the default GUI that Linux uses by running the switchdesk command.


If you've ever worked with theme files and come across a font named like this: -paradise-baskerville-medium-r-normal--0-0-0-0-p-0-iso8859-1 ...or you want to use the -fn/-font argument to something like xclock, but don't know the format, you need a handy tool called xlsfonts.  It prints the names of all the fonts recognized by your X server (or something like that).

Here's how to get rid of the ugly fonts in Linux, and replace them with some nice Windows TrueType fonts.  First, exit X windows so you've just got a command prompt.  Create the directory /usr/share/fonts/default/TrueType if it doesn't already exist.  Copy all the fonts from your Windows computer (in c:\windows\fonts or c:\winnt\fonts probably) into this folder.  Next, cd into that TrueType directory and run these two commands:

/usr/bin/ttmkfdir > fonts.scale

(Note -- you might not need to run those two commands... I think that's the case if you already had a TrueType directory.)

Next edit your /etc/X11/fs or /etc/X11/fs/config file, and add the line /usr/share/fonts/default/TrueType to the catalogue= section, and while you're there, make sure any entries with 100dpi are above any entries with 75dpi.

Now just reboot your computer (or, restart the X-font server with /sbin/service xfs restart and then restart X with startx), and you should have lots of nice fonts to choose from at all your font dialog boxes.


If your fonts are too big, use your theme manager to change their size.  I recently installed the Ximian Evolution email client, and it decided to make the menu font ridiculously big on my system... so even other programs like Mozilla's fonts were huge.  I couldn't figure out where to reset this until I stumbled upon the theme manager.


To make your console fonts nicer, install the SVGATextMode utility.  This allows you to change your resolution and refresh rate in the console.  Install it, then create a line at the bottom of /etc/TextConfig for your settings:

"Anthony"     28     728 744 888 944     445 455 457 495     font 8x9

Then switch to that new setting by running SVGATextMode Anthony.  That line is for my SiS 5597/5598 onboard video adapter; 28 is the pixel clock, 728 is the active horiz. video size, 944 is the full horiz. video size, 445 is the active vert. video size, 495 is the full vert. video size, and 8x9 is the size of one character.  (All sizes are in pixels.)  I also put these lines in the config file:

FontProg "/usr/bin/setfont"
FontPath "/usr/share/kbd/consolefonts"
FontSelect "default8x9.psfu.gz" 8x9

Then to cause these settings to take effect every time I boot, I added the line SVGATextMode Anthony to my /etc/rc.d/rc.local file.  (And actually, because there's a bug that sometimes causes it to fail to set the text mode properly, I added it twice, with sleep 1 in between the 2 calls.

Here are some definitions / calculations, from the manpage:

chars per line = active horiz. size / 8 = 728 / 8 = 91 chars
horiz. refresh rate = pixel clock / full horiz. size * (8/char width) = 28 / 944 * (8/8) = 29.66 kHz
number of textlines = active vert. size / char height = 445 / 9 = 49 lines
vert. refresh rate = horiz. refresh rate / full vert. size = 29.66 / 495 = 59.9 Hz
Back to Top



If you have a linux USB question or problem, it's probably answered over at  But if you're interested, I got my USB keyboard to work on my Slackware 8.1 box by using these 3 commands:

modprobe -a usb-ohci
modprobe -a keybdev
modprobe -a hid

Note that your system might use uhci controllers instead of ohci ones; run lspci -v|grep HCI and you should see either OHCI or UHCI in the output.

Back to Top


How to use the vi text editor

Vi is different from most text editors in that it has 2 modes - control and insert.  By default you're in control mode, so typing stuff will send commands to vi rather than putting the text into the document.  To switch to insert mode, so you can actually type text, you type a, A, i, I, o, or O.

To do this...Type this:
(At the shell) to start vi and edit /etc/file.txtvi /etc/file.txt
The rest of the commands are to be typed within vi itself!
open another file, and hide the current one:hide edit filename
reopen the current file (revert to saved version):e!
Save the file:w
Save the file (force):w!
Exit vi:q
Exit vi (force, quits without saving):q!
Switch to "insert mode" so you can type a (append text after the cursor)
A (append text at the end of the line)
i (insert text before the cursor)
I (insert text before the first non-blank in the line)
o (make ("open") new line below the current line)
O (make ("open") new line above the current line)
Switch to "control mode" so you can move around the document and use the colon commandsEsc
Jump down N linesN j
Jump up N linesN k
Jump to start of filegg
Jump to end of fileG
Jump to line NN gg
Jump to the line that is N percent down the fileN % (ex., type 100 % to go to the end, or 0 % for the start)
Jump forward/backward by one wordw or W / b or B (capitals don't stop at special chars)
Search for the word foo in the forward (down) direction/foo<ENTER>
Repeat last search in the forward (down) direction/<ENTER>
Search for the word foo in the backwards (up) direction?foo<ENTER>
un-highlight the highlighted search terms:noh or :nohlsearch
search and replace all occurrences of "foo" with "bar" from the current line to the next 10 lines, and ask you to confirm each replacement (/c)::.,+10s/foo/bar/gc
search and replace from the current line to the end of the file::.,$s/foo/bar/gc
search and replace in the entire open file::%s/foo/bar/gc
Change background color:hi Normal ctermbg=[0-9]
Change foreground color:hi Normal ctermfg=[0-9]
remove syntax hilighting:syntax clear
Copy this lineY or yy (or, 3Y to copy 3 lines, etc)
Copy this wordyw (or, 8yw to copy 8 words, etc)
Paste before cursorp
Paste after cursorP
Delete a characterx
Delete a worddw (or, 5dw to delete 5, etc)
Delete a linedd (or, 5dd to delete 5, etc)
Delete from cursor to end of the lineD
Undo last changeu
Undo changes to this lineU

To set up Vi after installing it, this is what I do:

  • copy ${install_dir}/vimrc_example.vim to ~/.vimrc

  • add these lines to that file, to turn off line wrapping, enable the mouse, and make highlighted words really stand out:
    set nowrap
    set sidescroll=1
    set mouse=a
    highlight Search ctermbg=blue ctermfg=white
  • Also add this line to that file, to allow the F11 key to toggle vim's paste-mode: while you're in insert mode, press F11 before pasting multiple copied lines, and you won't get lots of extra tabs:

    set pastetoggle=<F11>

For more Vi help, check out this page.

Back to Top


My Adventures with Sendmail

I'm using this code in a Perl script to send some email:

open(SENDMAIL, "|/usr/sbin/sendmail -oi -t") or die "Can't fork for sendmail: $!\n";
print SENDMAIL <<"EOF";
Content-Type: text/plain; 
From: me\
To: you\

close(SENDMAIL) or print warn "sendmail didn't close nicely: $!\n";

I learned a few useful things.  First, apparently, the default configuration on RedHat 7.3 is such that sendmail acts as its own smtp server, so the messages just go directly from my box to the recipient's POP3 mailhost.  Also, I learned that /var/log/maillog contains the status of each message you try to send.  Most entries will end in stat= indicating success or failure and the reason.

Back to Top


Random Other Stuff

To count the number of files in a directory, you can use the ls command with the wc command.  ls lists files, and wc counts things.  If you run this command, you'll get the number of files in the directory:

ls | wc -l

Note that those are both Ls, not ONEs, and there's a pipe between ls and wc.


This one problem was very frustrating to me until I found out that it was actually a feature.  You can lock a terminal by pressing Ctrl-s and unlock it with Ctrl-q.  Lots of times I thought that my terminal locked up or hung, but apparently I had accidentally locked it with Ctrl-s.  So if you have a problem where your Linux terminal freezes, try Ctrl-q.


The Linux directory structure (more here):

        /etc holds configuration files.  For example, /etc/lilo.conf has your boot options if you boot using LILO.


If your BIOS has a "Plug-and-Play OS" option, turn it off. When on, this option will let the OS initialize some plug and play devices. When off, the BIOS will perform the necessary initialization. For Linux, you need to have the BIOS handle the initialization.


To change the resolution, go to the terminal and type setup, and you'll get some video options.  (Works on RedHat Linux, and possibly others... not on Mandrake 8.1.)


The name of the program that displays the taskbar at the bottom of the screen is kicker (at least, on Makdrake 8.1 with KDE it is).  This is good to know in case you accidentally kill the taskbar, in which case you can right-click on the desktop and choose "run command" and type kicker to bring it back.


When I first installed XMMS, it would pause for about 15-20 seconds before each song, and would exhibit the same long pause when I manually started a track or switched songs.  (This is on a Linux-Mandrake 8.1 system, using XMMS 1.2.7, on a Pentium 233MMX computer.)  To fix this, I opened the KDE sound server (K-menu, Configuration, KDE, Sound, Sound Server) and disabled the option to "start aRts soundserver on KDE startup."  You might have to restart at this point since the sound server is already loaded.  In XMMS, I chose the OSS driver 1.2.7 as the output plugin, and I left the XMMS buffer settings at their default values of 3000ms with 25% pre-buffer.


I had lots of trouble installing glib and gtk+ and any programs that require them (which is most programs).  Version 2.0 of glib/gtk+ doesn't use glib-config/gtk-config anymore; instead, they use pkg-config.  And that doesn't quite work as a drop-in replacement.  Many programs that were expecting to find glib-config and gtk-config won't install without them.  I eventually got stuff to work by installing version 1.2.10 of both glib and gtk+, while still keeping version 2.0 installed too.  That seemed to make the other programs happy.


I needed to use "MandrakeUpdate" (K-menu, Configuration, Packaging, MandrakeUpdate) to install zip and yacc which are required by some programs.  I did have some version of zip already installed, but apparently it wasn't good enough for one program that I was trying to install.


Something went horribly wrong on my system, and when I'd boot, it would go to the logon prompt and then the screen would go blank.  Every few seconds it would blip slightly, and maybe every 20 seconds, the logon prompt would flash on the screen and quickly disappear.  This problem wasn't fixing itself, so I rebooted into failsafe mode, eventually made my way to a logon prompt, and logged in.  When I tried to startx, it would blank the screen, then come back with the error "Could not init font path element unix/:-1, removing from list!  Fatal server error: could not open default font 'fixed' ".  The fix was to edit my XF86Config-4 file with the vi text editor (using the command vi /etc/X11/XF86Config-4 ) and add the lines:

        FontPath "unix/:7100"
        FontPath: "/usr/X11R6/lib/X11/fonts/misc"

I added those right below the existing FontPath "unix/:-1" line.  Then I saved the file (that's :w in vi), quit vi (that's :q ), ran xfs & , and finally ran startx  .


While installing the Postfix SMTP server, it told me I needed to install the appropriate db*-devel package.  So I installed the most recent one.  But it Postfix still didn't like it.  It turns out that the db*-devel package you install must have the same version as the db* package on your system.  For example, running rpm -qa | grep db[123] | sort revealed that I had db3-3.1.17-4 installed.  The db*-devel package I installed was db3-devel-3.1.17-4.6.  So I had a -4 version of db, but I installed a -4.6 version of db*-devel.  That's why it still didn't work.  I needed to "upgrade" the -4.6 version to the -4 version (with the command rpm db3-devel-3.1.17-4 -U --oldpackage) to make it work.


To find out information about the IDE drives on your system, check out the /proc/ide/ directory.  For example, to find out the model numbers of your hard drive (usually hda) and your cdrom (usually hdc), type:

cat /proc/ide/hda/model
cat /proc/ide/hdc/model


To enable DMA for your drives (or to check its status, or test transfer rates, etc), use the hdparm utility.  For example, to turn on DMA for your CDrom drive (assuming it's at /dev/hdc), type:

hdparm -d 1 /dev/hdc


To connect to a remote X-Windows server, so that you can run windowed programs on a remote machine but have the windows show up on your local machine, do this.  Assuming your computer is and the remote machine is, then at your local machine type xhost  Next log in to the remote machine using SSH with the command ssh <username> where username is for your account on the remote machine.  Once you get logged in, you need to set the DISPLAY environment variable to point to your local machine.  If you're using the c shell, type setenv DISPLAY, or, if you're using the bourne shell, type; export DISPLAY.  That's it -- now just use your SSH prompt to start programs on the remote machine, and their windows will come up on your local screen.

(UPDATE: if that doesn't work, try skipping all the stuff with the DISPLAY variable, and instead use the -X (X11-forwarding) option to the ssh command when you connect to

If you're behind a firewall, you'll need to tell it to forward some traffic to your Linux box.  That's because by default, the ports used by the X-server will be blocked by the firewall.  On my system, those ports were 6000 (the X11 port) and 35716.  To discover those numbers, I first set my firewall to use my Linux box as the DMZ host (which causes all ports to be forwarded to it -- in other words, it "turns off" the firewall for the Linux box).  Then I followed the procedure above for forwarding the X-Windows display, started a remote program, then on the local machine, I ran netstat (and then netstat --numeric-ports).  I looked for the lines that showed TCP connections from my PC to the remote X host, and those lines showed ports 6000 and 35716.  So after discovering those port numbers, I disabled the DMZ host in the firewall, and then set it to forward traffic on those 2 ports to the Linux box.

(Thanks to this page for help figuring all this out.)


To change to a different shell, type chsh <username> /usr/bin/<shellname> or chsh <username> /bin/<shellname> depending on where your shells (tsh, csh, bash, etc) are stored.


To change your password, use the passwd command.


To get my Creative Soundblaster Audigy working under Linux, here's what I did.  (Should also work for SBLive! and Live! users.)

  1. I downloaded the latest emu10k1 package from, which was called emu10k1-v0.20a.tar.bz2.  So I had to un-bzip that with bzip2 -d emu10k1-v0.20a.tar.bz2 which produced emu10k1-v0.20a.tar, and I had to un-tar that with tar -xvf emu10k1-v0.20a.tar.  This made a folder called emu10k1-v0.20a, so I switched to that directory and typed make.  This gave me an error about a config file missing.  When I went to look at the directory that was supposed to contain the file, everything was missing.  So apparently my linux source files were not installed.
  2. Installed my linux source files.  I used uname -r to find out which kernel version I had, which was 2.4.18-14.  So I searched the net for kernel-2.4.18-14 source, and since I'm on a RedHat Linux system, I downloaded a file called kernel-2.4.18-14.src.rpm.  Once that was downloaded, I installed it (as root) with rpm --install kernel-2.4.18-14.src.rpm.
  3. Back in the emu10k1-v0.20a directory, I ran make again.  It still complained about that file missing, but told me what to do to fix it.  I had to (as root) copy /lib/modules/2.4.18-14/build/configs/kernel-2.4.18-14-i686.config to /lib/modules/2.4.18-14/build/.config ... so I did.
  4. Ran make again, and this time it worked.  Once it ran, it told me to run it again, so I did, and then I had to become root and run make install.  That's it, my sound works nicely now.

(Note: this page (cached) also has instructions, including the "old way" to do it, involving /etc/conf.modules and "alias sound" and depmod and modprobe.  From what I understand, that way is deprecated, but I wanted to link it here just in case it's helpful to someone.)


There's a free program called parted that lets you move partitions and resize partitions without losing the data that's on them.  I recently used it to resize my linux boot partion.  The partition was 2.5 gigabytes, and there was about 2.2 gigabytes of free space after the boot partition and before the next partition.  But I was running out of space on my boot partition, so I wanted to make it bigger.  Here's what I did:

  1. Installed parted from the link above.
  2. Created a boot disk (actually I used the floppy boot disk that RedHat Linux asked me to create when I installed it).  Restarted my computer, entered the BIOS and set it to use the floppy drive as the first boot device, and then booted off the floppy.
  3. Once the boot was finished, I logged in and typed init 1 (that's a one, not an L) to switch to runlevel 1, single user mode.  This was necessary to stop any running programs from using the boot partition that I wanted to resize.
  4. I needed to unmount the boot partition before I could resize it, so I typed umount /dev/hda1 (that's hdaONE, not hdaL).
  5. To check the integrity of the partition and fix any problems before trying to resize it, I ran e2fsck -c /dev/hda1 (again, hdaONE).
  6. Finally, I ran parted.  I typed print at the parted prompt to see where my boot partition (called "minor 1" in parted) started at, which was 0.031 MB.  To actually perform the resize, I typed resize 1 0.031 4700 ... so the partition "minor 1" will now end at 4700 MB.
  7. Near the end of (or maybe just after) the resize operation, parted gave me an error, segmentation fault.  I ran parted again and typed print, and it showed the partition's ending point at 4700, so apparently the resize worked OK.  But just to be safe, I typed rescue 0.031 4700 at the parted prompt.  I don't know whether this helped or not, but it seemed like a good idea.
  8. I removed the floppy disk and rebooted, and it booted up fine.  I logged in and ran df -hm, and sure enough, the partition got resized correctly!  Woohoo!


I installed the enlightenment window manager, on my RedHat Linux 8.0 system, which had been running the KDE window manager / desktop environment.  To use enlightenment instead of KDE, I logged out of KDE, which exited the X windows server.  But I couldn't run startx, because that would automatically start KDE again.  Instead, I ran xinit, and then ran enlightenment.  To make enlightenment start by default instead of KDE, I edited the file /home/username/.Xclients-default, which previously contained a line to start KDE.  I changed that line so it now reads exec enlightenment.


To launch a terminal (like xterm or konsole) and have it run a program immediately, launch it with the -e switch followed by the program you want to run.


To have enlightenment run a certain program whenever it starts, first start enlightenment and run the program.  Then middle-click on the title bar of the window (or do whatever you need to do to cause the Close / Annihilate / Raise / Lower / etc menu to appear), and choose "Remember..."  Set the options you'd like, and that program's window will come back when you reboot.  However, in certain situations the window won't contain what you'd expect; for example, if it's an xterm window that you started, and then manually typed a command.  So you may need to edit the command used to start the window.  This is in the file /home/username/.enlightenment/...e_session-XXXXXX.snapshots.0 (this is correct on my Slackware Linux 8.1 box with Enlightenment v16).  The window that you added via the "Remember..." feature should be listed at the bottom of this file.  For example, my entry for xclock looks like this:

NEW: xclock.XClock
NAME: xclock
RES: 1024 768
WH: 71 71
XY: 945 0 0 0
CMD: xclock -padding 1 -geometry 71x71

So you can edit CMD to set the program and switches you'd like.


To send an email from the shell using mutt, you might have some trouble.  I had this all figured out, but then a new version of mutt was released, and it wouldn't work like the old one.  I couldn't figure it out for the longest time, and the mutt documentation is horrible.  Anyway, the problem was that my one-line shell command that used to send a message was now starting mutt and waiting for input!  So here's how to send an email with a binary attachment using mutt, from the shell, non-interactively:

mutt -a attachment.tar.gz -s "this is the subject" </dev/null

The </dev/null at the end is the important part... without that, mutt will start up in interactive mode, and your message won't get sent.  This works on mutt 1.4i, but don't be surprised if the next version breaks it!


To set the mouse speed in X-windows, use the xset command.  Typing xset m x y will cause the mouse to accelerate by a multiple of x after moving y pixels.  I like my mouse set at xset m 2 4, with the line Option "Resolution" 300 in my XF86Config file.  To set your xset setting every time you run X, add your xset line to the top of your /home/username/.xinitrc file.

You can also use xset s off to disable the screensaver / auto-blanking feature of your monitor.


To find out which version of libc you have, type ls -l /lib/libc*.


If you're installing linux and it crashes at some point (but it already installed your packages, and it's bootable), try running startx to see if you can start your window manager.  If not, run xf86config to set up the X server, and then you may be able to run startx.


In Gnome, if you want to change the default text editor, default web browser, and default terminal, you need to run gnome-default-applications-properties because if you try to set these things in Nautilus, via the File Types or Preferred Applications or any of that, you'll find that those things are broken, or at least, they don't do what you'd expect them to do.


On my Red Hat 8.0 system, I managed to get things to print like this:
1. Plug my HP Deskjet 932c into the system's USB port.
2. Run printconf-gui and set the printer up... name it hpusb.
3. To print a postscript document, use this command:
    gs -dSAFER -dNOPAUSE -dBATCH -q -sDEVICE=cdj550 -sOutputFile=\|"lpr -P hpusb"
4. To print a text document: cat filename.txt | lpr -P hpusb

To print to a network printer, connected to a Windows machine and shared from there, this worked (but I couldn't figure it out for postscript files):
cat filename.txt | smbclient "\\\\windowsbox\\printershare" "password" -E -I -N -P -U "username" -W "WORKGROUP" -c "translate ; print -"

...where -I is the IP of windowsbox and printershare is the share-name of the printer.  Note that you must have an account set up on the Windows box with this username and password, and that account must have printing privileges on printershare.


That annoying dos newline problem: you open a text file on your linux machine, and every line ends in a ^M character.  Or, you open it in the vi editor, and it says [dos] at the bottom of the screen.  In any case, if it's a script, it won't run correctly on the linux machine.  To fix that, you have to get rid of those dos newline characters.  Here's a perl script that did it for me:

die "Usage: $0 <file to convert from DOS to UNIX newlines>\n" unless defined $ARGV[0];
my @newfile;
open(IO,"+<$ARGV[0]") or die "$0: couldn't open $ARGV[0] for R/W: $!\n";
flock IO, 2;
seek IO, 0, 0;
        chop; chop;
        push @newfile, "$_\n";
seek IO, 0, 0;
print IO @newfile;
truncate IO, tell IO;
close IO or die "$0: couldn't close IO: $!\n";

I just saved that as /usr/bin/dos2unix and then chmodded it a+x.  Even more handy, if you want to fix the newline problem from the shell prompt, type this (with all the slashes and quotes, and all on one line):

perl -e "my @newfile; open(IO,\"+<file.txt\"); flock IO,2; seek IO,0,0;
while(<IO>) { chop; chop; push @newfile, \"\$_\n\"; } seek IO,0,0;
print IO @newfile; truncate IO, tell IO;"


I have a motherboard (Atrend ATC7110M) with onboard sound (Fortemedia FM801), and it wouldn't work with Slackware Linux.  But I found out that I could use the alsa driver to make it work.  So I downloaded the driver (but not the libs package, nor the utils package) and extracted it, and then followed (most of) the directions on this page.  Which were basically:

  • run modinfo soundcore to make sure that's installed
  • in the directory I extracted the alsa driver package to, run ./configure --with-cards=fm801 --with-sequencer=yes
  • run make and then make install
  • run ./snddevices
  • (run chmod a+rw /dev/dsp /dev/mixer /dev/sequencer /dev/midi if you're going to have non-root-users using the soundcard)
  • now just modprobe 'em into the running kernel:
    modprobe snd-fm801
    modprobe snd-pcm-oss

    and optionally...
    modprobe snd-mixer-oss
    modprobe snd-seq-oss


If you care about having accurate time on your system, or if your motherboard's battery-backup is broken, you'll want to use ntpd to sync your system's clock with an internet timeserver.  The quick start page in the NTP documentation explains all you need to know to quickly get set up.  Once the package is installed, there's really only 2 things to do:

  1. Edit /etc/ntp.conf to contain lines that say server from the list of public servers.  My file looks like this:

    # PA
    server burst iburst
    # TX
    server burst iburst
    # NV
    server burst iburst
    server burst iburst
    # NY
    server burst iburst
    # WI
    server burst iburst
    server burst iburst
    driftfile /etc/ntp/drift

    The burst and iburst keywords basically cause the synchronization of your clock to happen faster; on my Slackware 9.1 / P-III 1.13GHz / cable modem system, without burst and iburst, it takes about 10 minutes for the clock to get sync'd.  If I use burst and iburst, it takes <1 minute.

  2. Run ntpd -g.  The -g is so that synchronization will take place even if your clock is really far off (i.e. if your CMOS battery is dead, so your clock says it's 1998).


To do backups of entire folders/directories/filesystems, use rsync.  It's incredibly powerful and easy... well, it's only easy once you figure it out, but I've already done that.  Here's how to use it.


Note: when compiling / debugging programs, including when you're trying to install a program via make, adding a line at the top of the #includes section that says "#include <sys/types.h>" will often solve problems.


To install my HP DeskJet 932C USB printer on my Slackware 9.0 system, I followed the directions at  Here's what I did:

  1. Download and install CUPS, the "Common UNIX Printing System."  Once installed, you should be able to run the "cupsd" executable as root, and then browse to http://localhost:631/ to configure your printers.  You need to log in to do anything important, and the login is your system's root account.

  2. Download and install "ESP Ghostscript" from the same page.  I had to install version 7.05; I couldn't get my printer to work with version 7.07.  Also, I had to use "./configure --prefix=/usr" instead of just plain ./configure, otherwise it was putting the text "NONE" in front of all the paths it tried to use, and wouldn't work.  Once this is installed, you should be able to run "gs -h" and see some of the ghostscript settings.  (Note that hpdj93x[c] isn't listed in the output of that command with the other printers, but that's OK, as long as "ijs" is listed.)

  3. Download and install the HPIJS driver from this page:  (I skipped the "distribution specific" section of that page.)  Once installed, you should be able to run "hpijs -h" and get a little ditty saying it's installed.

  4. Somewhere in the HPIJS package there are "PPD" files; I found the one called HP-DeskJet_932C-hpijs.ppd and copied it into the /usr/share/cups/model/ directory.  Make sure this file is world-readable.

  5. Do step 4 from the page above:

    cd /usr/bin
    chmod 755 foomatic-rip foomatic-gswrapper
    ln -s /usr/bin/foomatic-rip /usr/lib/cups/filter/foomatic-rip

  6. As root, kill the CUPS daemon (cupsd) and restart it.  At the CUPS web-based configuration page, add your printer.  Note that the text fields you get to specify (including "location") are descriptive (it's not a hardware location, like /dev/usb, but a physical location, like "3rd floor").

  7. Do step 6 from the page above:

    cd /tmp
    chmod 755 alignmargins

  8. You should now be able to print a test page through the CUPS web interface, print from the console with the lp command, and print from any program's Print function.

I also have a little guide on how to print multiple pages per sheet.

To allow my Windows machine to print to my Linux printer over the network, I did this:

  1. First, make sure Samba is installed and working.  See "Networking with Windows Machines" on this page.

  2. Edit /etc/samba/smb.conf, comment out the default [printers] section, and add this to the bottom:

    path = /var/spool/samba
    printable = yes
    public = yes
    writable = yes
    print command = lpr -P %p -o raw %s -r

    Note that /var/spool/samba should be chmod 1777, and that the Windows username/password who is going to be printing to this printer must have a valid account with the same username/password on your Linux box.  (Note to self -- look into this -- does "public = yes" here make that untrue, or does that just allow the guest account to print?)

  3. Also in /etc/samba/smb.conf, I uncommented the "load printers = yes" line, but did NOT uncomment the "printcap" or "printing" lines.

  4. On the Windows machine, install the printer as a network printer, and install the Windows driver for it.

Back to Top


More Notes

Sometimes I get lazy and just create too many linux notes to be willing to spend the time formatting them nicely.  So here are a bunch of unformatted notes.

to make your system use the ide-scsi emulation for your IDE cdrom drives
(needed for better performance, and for cdwriting and dvd drives, etc):

make sure that ide-scsi module is available:
as root, run lsmod and see if it's there.
if not, run modprobe ide-scsi and see if it gets loaded.
(it also might be built into the kernel, instead of built as a module.)

at the end of each bootable entry in /etc/lilo.conf, add this:
append="hdc=ide-scsi hdd-ide-scsi"
(where hdc and hdd are the cdroms that you want to use the ide-scsi module)

make sure that you have a /dev/scd0 that is brw-r--r--, and a /dev/sg0 that
is crwxrwxrwx.  (similarly, scd1 and sg1 for an additional drive, etc.)

put an audio CD in the drive and run this to check if it works:
cdparanoia -d /dev/sg0 -Q
cdparanoia -d /dev/sg1 -Q

to backup one dir to another, deleting any files in the dest that no longer
exist in the source, run:

rsync -axv --delete /source /dest

-a means make exact copies (owner, timestamp, etc)
-x means stay within one partition on /source (in case other stuff is mounted below)
-v means show files as they're processed

note that the source and/or dest can be entire partitions; for example, mount a
drive at /mnt/backup and then do:

rsync -axv --delete / /mnt/backup backup your entire main partition to /mnt/backup.  the drive mounted at /mnt/backup
will then be an exact copy, and it'll be completely functional if you boot it.  (you'll
have to put it on the first drive controller and then boot from a linux CD first, so
you can run lilo one time, to give it a proper boot sector.  and you'll have to create
a swap partition on the backup disk too, if there isn't one already (use (c)fdisk, mkswap,
mkfs, and swapon to make it).)

when installing alsa, you want to use alsa, not OSS, nor OSS emulation, or anything like
that.  to make it work, you probably *do* have to run the ./snddevices script after
building alsa-driver, even though the alsa webpage makes it sound like you shouldn't do
that.  to check if you really are using alsa, and not OSS, try to use the alsa
plugin in XMMS, or try to use aplay to play a wav file, or use aplay -l to see if it
finds your soundcard, or try to run alsamixer to make sure it runs.  If those
things work, then you've got alsa.

Most linux systems have their hardware clocks set to UTC (aka GMT).  All should
have them set thusly.  To deliver local time, so that functions like C's localtime()
or the system's date function can return local values for users, linux systems use timezone
files.  There are files for every timezone in /usr/share/zoneinfo/, and the file 
/etc/localtime should be a softlink to a file such as /usr/share/zoneinfo/US/Eastern. 
There is another file called /etc/timezone, and this file should contain a single line like
America/New_York which must be an existing path below /usr/share/zoneinfo/.  I'm not
sure of the connection between /etc/timezone and /etc/localtime, nor which if either takes
precedence.  In my experience, /etc/localtime is the one that matters. 

Once you have the timezone set, check the date by issuing the date command.  If it's
incorrect, issue date -s <string> where string is in the same format as that returned
when issuing date by itself.  This sets the system (software) time; to set the hardware
clock to this time, issue hwclock --systohc.

To use my Gravis GamePad Pro USB with linux, I just plugged it in and ran (as root)
modprobe joydev.  I then was able to use my NES emulator to play Nintendo ROMS
(as root: fceu -joy1 1 RBIBaseball.NES).

To make a program start automatically at boot on Debian (and possibly other systems
that use the System V style init scripts), let's call it program "foobar",
copy /etc/init.d/skeleton to /etc/init.d/foobar.  Then edit that file,
probably just changing the value of $DAEMON to /path/to/foobar.  Then
run the command update-rc.d foobar defaults, which will
place shortcuts appropriately into the /etc/rcN.d/ directories so that the
program starts/stops correctly when switching between runlevels including

If your system is currently in some runlevel that only has one terminal (i.e. you can't
use Alt+F2 to switch to terminal 2, etc), then you can run:

	agetty 38400 tty2 linux

...and that will start a new terminal on tty2.

More Help

David's Linux Experience
Newbies help
Tips for Linux
From Power Up To Bash Prompt: how Linux works

Back to Top