For People New to Both FreeBSD and UNIX®
Prev |  | Next

# 6 Printing Files from DOS

At this point you probably do not have the printer working, so here is a way to create a file from a manual page, move it to a floppy, and then print it from DOS. Suppose you want to read carefully about changing permissions on files (pretty important). You can use `man chmod` to read about it. The command

    % man chmod | col -b > chmod.txt

will remove formatting codes and send the manual page to the `chmod.txt` file instead of showing it on your screen. Now put a dos-formatted diskette in your floppy drive `a`, `su` to `root`, and type

    # /sbin/mount -t msdosfs /dev/fd0 /mnt

to mount the floppy drive on `/mnt`.

Now (you no longer need to be `root`, and you can type `exit` to get back to being user jack) you can go to the directory where you created `chmod.txt` and copy the file to the floppy with:

    % cp chmod.txt /mnt

and use `ls /mnt` to get a directory listing of `/mnt`, which should show the file `chmod.txt`.

You might especially want to make a file from `/sbin/dmesg` by typing

    % /sbin/dmesg > dmesg.txt

and copying `dmesg.txt` to the floppy. `/sbin/dmesg` is the boot log record, and it is useful to understand it because it shows what FreeBSD found when it booted up. If you ask questions on the FreeBSD general questions mailing list or on a USENET group--like “FreeBSD is not finding my tape drive, what do I do?”--people will want to know what `dmesg` has to say.

You can now unmount the floppy drive (as `root`) to get the disk out with

    # /sbin/umount /mnt

and reboot to go to DOS. Copy these files to a DOS directory, call them up with DOS EDIT, Windows® Notepad or Wordpad, or a word processor, make a minor change so the file has to be saved, and print as you normally would from DOS or Windows. Hope it works! Manual pages come out best if printed with the DOS `print` command. (Copying files from FreeBSD to a mounted DOS partition is in some cases still a little risky.)

Getting the printer printing from FreeBSD involves creating an appropriate entry in `/etc/printcap` and creating a matching spool directory in `/var/spool/output`. If your printer is on lpt0 (what DOS calls LPT1), you may only need to go to `/var/spool/output` and (as `root`) create the directory `lpd` by typing: `mkdir lpd`, if it does not already exist. Then the printer should respond if it is turned on when the system is booted, and `lp` or `lpr` should send a file to the printer. Whether or not the file actually prints depends on configuring it, which is covered in the FreeBSD handbook.

Prev | Home | Next
Editing Text |  | Other Useful Commands

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.