diff --git a/en/tutorials/Makefile b/en/tutorials/Makefile index c32c458f52..40a10bc3f1 100644 --- a/en/tutorials/Makefile +++ b/en/tutorials/Makefile @@ -1,4 +1,5 @@ DOCS= index.sgml -SUBDIR= disklessx -DOCSUBDIR= ddwg devel fonts mh multios newuser ppp +SUBDIR= disklessx newuser +DOCSUBDIR= ddwg devel fonts mh multios ppp + .include "../web.mk" diff --git a/en/tutorials/index.sgml b/en/tutorials/index.sgml index 897accc191..ebbc838f65 100644 --- a/en/tutorials/index.sgml +++ b/en/tutorials/index.sgml @@ -1,6 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN" [ <!ENTITY base CDATA ".."> -<!ENTITY date "$Date: 1997-01-17 15:00:57 $"> +<!ENTITY date "$Date: 1997-01-18 02:24:07 $"> <!ENTITY title "FreeBSD Tutorials"> <!ENTITY % includes SYSTEM "../includes.sgml"> %includes; ]> @@ -13,9 +13,8 @@ <a href="mailto:freebsd-doc@FreeBSD.ORG">freebsd-doc@FreeBSD.org</a>.</p> <ul> - <li><a href="newuser/newuser.html">For People New to Both FreeBSD <em>and</em> Unix</a> - (<a href="newuser/newuser.ps">postscript</a>, - <a href="newuser/newuser-html.tar.gz">gzipd tar file</a>)</li> + <li><a href="newuser/newuser.html">For People New to Both FreeBSD + <em>and</em> Unix</a></li> <li><a href="mh/mh.html">An introduction to the MH mail software</a> (<a href="mh/mh.ps">postscript</a>, <a href="mh/mh-html.tar.gz">gzipd tar file</a>)</li> diff --git a/en/tutorials/newuser/Makefile b/en/tutorials/newuser/Makefile index d8d8509284..a0f6762443 100644 --- a/en/tutorials/newuser/Makefile +++ b/en/tutorials/newuser/Makefile @@ -1,5 +1,5 @@ -DOC= newuser -SRCS= newuser.sgml +DOCS= newuser.docb +INDEXLINK= newuser.html -.include <bsd.sgml.mk> +.include "../../web.mk" diff --git a/en/tutorials/newuser/newuser.docb b/en/tutorials/newuser/newuser.docb new file mode 100644 index 0000000000..c98403616b --- /dev/null +++ b/en/tutorials/newuser/newuser.docb @@ -0,0 +1,844 @@ +<!DOCTYPE BOOK PUBLIC "-//Davenport//DTD DocBook V3.0//EN"> +<book> + +<bookinfo> +<bookbiblio> +<title>For People New to Both FreeBSD and Unix</title> + +<authorgroup> +<author> +<firstname>Annelise</firstname> +<surname>Anderson</surname> +<affiliation> +<address><email>andrsn@hoover.stanford.edu</email></address> +</affiliation> +</author> +</authorgroup> + +<pubdate>June 30, 1996</pubdate> + +<abstract><para>Congratulations on installing FreeBSD! This +introduction is for people new to both FreeBSD +<emphasis>and</emphasis> Un*x—so it starts with basics. It +assumes you're using version 2.0.5 or later of FreeBSD as distributed +by Walnut Creek or FreeBSD.ORG, your system (for now) has a single +user (you)—and you're probably pretty good with DOS/Windows or +OS/2.</para></abstract> + +</bookbiblio> +</bookinfo> + +<chapter> +<title>Logging in and Getting Out</title> + +<para>Log in (when you see <systemitem +class=prompt>login:</systemitem>) as a user you created during +installation or as <firstterm>root</firstterm>. (Your FreeBSD +installation will already have an account for root; root can go +anywhere and do anything, including deleting essential files, so be +careful!)</para> + +<para>To log out (and get a new <systemitem class=prompt>login:</systemitem> prompt) type +<informalexample> +<screen># <userinput>exit</userinput></screen> +</informalexample> +as often as necessary. Yes, press <keysym>enter</keysym> after +commands, and remember that Unix is +case-sensitive—<command>exit</command>, not +<command>EXIT</command>.</para> + +<para>To shut down the machine type: +<informalexample> +<screen># <userinput>/sbin/shutdown -h now</userinput></screen> +</informalexample> +Or to reboot type +<informalexample> +<screen># <userinput>/sbin/shutdown -r now</userinput></screen> +</informalexample> +or +<informalexample> +<screen># <userinput>/sbin/reboot</userinput></screen> +</informalexample> +</para> + +<para>You can also reboot with +<keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>Delete</keycap></keycombo>. +Give it a little time to do its work. This is equivalent to +<command>/sbin/reboot</command> in recent releases of FreeBSD, and is +much, much better than hitting the reset button. You don't want to +have to reinstall this thing, do you?</para> + +</chapter> + +<chapter> +<title>Adding A User with Root Privileges</title> + +<para>If you didn't create any users when you installed the system and +are thus logged in as root, you should probably create a user now with +<informalexample> +<screen># <userinput>adduser</userinput></screen> +</informalexample> +Don't use the <option>-verbose</option> option; the defaults are what +you want. Suppose you create a user <emphasis>jack</emphasis> with +full name <emphasis>Jack Benimble</emphasis>. Give jack a password +if security (even kids around who might pound on the keyboard) is an +issue. When it asks you if you want to invite jack into other +groups, type <userinput>wheel</userinput> +<informalexample> +<screen>Login group is ``jack''. Invite jack into other groups: <userinput>wheel</userinput></screen> +</informalexample> +This will make it possible to log in as <emphasis>jack</emphasis> and +use the <command>su</command> command to become root. Then you won't +get scolded any more for logging in as root, and as root you'll have +the same environment as jack (this is good).</para> + +<para>You can quit <command>adduser</command> any time by typing +<keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo>, and at +the end you'll have a chance to approve your new user or simply type +<keycap>n</keycap> for no. You might want to create a +second new user (jill?) so that when you edit jack's login files, +you'll have a hot spare in case something goes wrong.</para> + +<para>Once you've done this, use <command>exit</command> +to get back to a login prompt and log in as +<emphasis>jack</emphasis>. In general, it's a good idea to do as +much work as possible as an ordinary user who doesn't have the +power—and risk—of root.</para> + +<para>If you already created a user and you want the user to be able +to <command>su</command> to root, you can log in as root +and edit the file <filename>/etc/group</filename>, adding jack to the +first line (the group wheel). But first you need to practice +<command>vi</command>, the text editor.</para> + +</chapter> + +<chapter> +<title>Looking Around</title> + +<para>Logged in as an ordinary user, look around and try out some +commands that will access the sources of help and information within +FreeBSD.</para> + +<para>Here are some commands and what they do: +<variablelist> +<varlistentry><term><command>id</command></term> +<listitem> +<para>Tells you who you are!</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>pwd</command></term> + +<listitem> +<para>Shows you where you are—the current +working directory.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls</command></term> + +<listitem> +<para>Lists the files in the current directory.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls <option>-F</option></command></term> + +<listitem> +<para>Lists the files in the current directory with a +<literal>*</literal> after executables, a <literal>/</literal> after +directories, and an <literal>@</literal> after symbolic links.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls <option>-l</option></command></term> + +<listitem> +<para>Lists the files in long format—size, +date, permissions.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls <option>-a</option></command></term> + +<listitem> +<para>Lists hidden (unless you're root) <quote>dot</quote> +files with the others.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>cd</command></term> + +<listitem> +<para>Changes directories. <command>cd +<parameter>..</parameter></command> backs up one level; note the +space after <command>cd</command>. <command>cd +<parameter>/usr/local</parameter></command> goes there. <command>cd +<parameter>~</parameter></command> goes to the home directory of the +person logged in—e.g., <filename>/usr/home/jack</filename>. +Try <command>cd <parameter>/cdrom</parameter></command>, and then +<command>ls</command>, to find out if your CDROM is mounted and +working.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>view <replaceable>filename</replaceable></command></term> + +<listitem> +<para>Lets you look at a file (named +<replaceable>filename</replaceable> without changing it. Try +<command>view <parameter>/etc/fstab</parameter></command>. +<command>:q</command> to quit.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>cat <replaceable>filename</replaceable></command></term> + +<listitem> + +<para>Displays <replaceable>filename</replaceable> on screen. If +it's too long and you can see only the end of it, press +<keycap>ScrollLock</keycap> and use the <keycap>up-arrow</keycap> to +move backward; you can use <keycap>ScrollLock</keycap> with man pages +too. Press <keycap>ScrollLock</keycap> again to quit scrolling. You +might want to try <command>cat</command> on some of the dot files in +your home directory—<command>cat +<parameter>.cshrc</parameter></command>, <command>cat +<parameter>.login</parameter></command>, <command>cat +<parameter>.profile</parameter></command>.</para> + +</listitem> +</varlistentry> +</variablelist> + +You'll notice aliases in <filename>.cshrc</filename> for some of the +<command>ls</command> commands (they're very convenient). +You can create other aliases by editing <filename>.cshrc</filename>. +You can make these aliases available to all users on the system by +putting them in the system-wide csh configuration file, +<filename>/etc/csh.cshrc</filename>.</para> + +</chapter> + +<chapter> +<title>Getting Help and Information</title> + +<para>Here are some useful sources of help. +<replaceable>Text</replaceable> stands for something of your choice +that you type in—usually a command or filename.</para> + +<variablelist> +<varlistentry><term><command>apropos <replaceable>text</replaceable></command></term> + +<listitem> +<para>Everything containing string <replaceable>text</replaceable> +in the <database>whatis database</database>.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>man <replaceable>text</replaceable></command></term> + +<listitem> +<para>The man page for <replaceable>text</replaceable>. The major +source of documentation for Un*x systems. <command>man +<parameter>ls</parameter></command> will tell you all the ways to use +the <command>ls</command> command. Press <keycap>Enter</keycap> to +move through text, +<keycombo><keycap>Ctrl</keycap><keycap>b</keycap></keycombo> to go +back a page, <keycombo><keycap>Ctrl</keycap><keycap>f</keycap></keycombo> to +go forward, <keycap>q</keycap> or +<keycombo><keycap>Ctrl</keycap><keycap>c</keycap></keycombo> to +quit.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>which <replaceable>text</replaceable></command></term> + +<listitem> +<para>Tells you where in the user's path the command +<replaceable>text</replaceable> is found.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>locate <replaceable>text</replaceable></command></term> + +<listitem> +<para>All the paths where the string <replaceable>text</replaceable> +is found.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>whatis <replaceable>text</replaceable></command></term> + +<listitem> +<para>Tells you what the command <replaceable>text</replaceable> +does and its man page.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>whereis <replaceable>text</replaceable></command></term> + +<listitem> +<para>Finds the file <replaceable>text</replaceable>, giving its full +path.</para> +</listitem> +</varlistentry> +</variablelist> + +<para>You might want to try using <command>whatis</command> on some +common useful commands like <command>cat</command>, +<command>more</command>, <command>grep</command>, +<command>mv</command>, <command>find</command>, +<command>tar</command>, <command>chmod</command>, +<command>chown</command>, <command>date</command>, and +<command>script</command>. <command>more</command> lets you read a +page at a time as it does in DOS, e.g., <command>ls -l | +more</command> or <command>more +<replaceable>filename</replaceable></command>. The +<literal>*</literal> works as a wildcard—e.g., <command>ls +w*</command> will show you files beginning with +<literal>w</literal>.</para> + +<para>Are some of these not working very well? Both +<command>locate</command> and <command>whatis</command> +depend on a database that's rebuilt weekly. If your machine isn't +going to be left on over the weekend (and running FreeBSD), you might +want to run the commands for daily, weekly, and monthly maintenance +now and then. Run them as root and give each one time to finish +before you start the next one, for now. +<informalexample> +<screen># <userinput>/etc/daily</userinput> +<lineannotation>output omitted</lineannotation> +# <userinput>/etc/weekly</userinput> +<lineannotation>output omitted</lineannotation> +# <userinput>/etc/monthly</userinput> +<lineannotation>output omitted</lineannotation></screen> +</informalexample></para> + +<para>If you get tired waiting, press +<keycombo><keycap>Alt</keycap><keycap>F2</keycap></keycombo> to get +another <firstterm>virtual console</firstterm>, and log in again. +After all, it's a multi-user, multi-tasking system. Nevertheless +these commands will probably flash messages on your screen while +they're running; you can type <command>clear</command> at the prompt +to clear the screen. Once they've run, you might want to look at +<filename>/var/mail/root</filename> and +<filename>/var/log/messages</filename>.</para> + +<para>Basically running such commands is part of system +administration—and as a single user of a Unix system, you're +your own system administrator. Virtually everything you need to be +root to do is system administration. Such responsibilities aren't +covered very well even in those big fat books on Unix, which seem to +devote a lot of space to pulling down menus in windows managers. You +might want to get one of the two leading books on systems +administration, either Evi Nemeth et.al.'s <citetitle>UNIX System +Administration Handbook</citetitle> (Prentice-Hall, 1995, ISBN +0-13-15051-7)—the second edition with the red cover; or +Æleen Frisch's <citetitle>Essential System +Administration</citetitle> (O'Reilly & Associates, 1993, ISBN +0-937175-80-3). I used Nemeth.</para> + +</chapter> + +<chapter> +<title>Editing Text</title> + +<para>To configure your system, you need to edit text files. Most of +them will be in the <filename>/etc</filename> directory; and you'll +need to <command>su</command> to root to be able to change them. The +text editor is <command>vi</command>. Before you edit a file, you +should probably back it up. Suppose you want to edit +<filename>/etc/sysconfig</filename>. You could just use <command>cd +/etc</command> to get to the <filename>/etc</filename> directory and +do: +<informalexample> +<screen># <userinput>cp sysconfig sysconfig.orig</userinput></screen> +</informalexample> + +This would copy <filename>sysconfig</filename> to +<filename>sysconfig.orig</filename>, and you could later copy +<filename>sysconfig.orig</filename> to <emphasis +remap=tt>sysconfig</emphasis> to recover the original. But even +better would be moving (renaming) and then copying back: +<informalexample> +<screen># <userinput>mv sysconfig sysconfig.orig</userinput> +# <userinput>cp sysconfig.orig sysconfig</userinput></screen> +</informalexample> + +because the <command>mv</command> command preserves the original date +and owner of the file. You can now edit +<filename>sysconfig</filename>. If you want the original back, you'd +then <userinput>mv sysconfig syconfig.myedit</userinput> +(assuming you want to preserve your edited version) and then +<informalexample> +<screen># <userinput>mv sysconfig.orig sysconfig</userinput></screen> +</informalexample> +to put things back the way they were.</para> + +<para>To edit a file, type +<informalexample> +<screen># <userinput>vi <replaceable>filename</replaceable></userinput></screen> +</informalexample> +Move through the text with the arrow keys. <keycap>Esc</keycap> (the +escape key) puts <command>vi</command> in command mode. Here are some +commands: +<variablelist> +<varlistentry><term><command>x</command></term> +<listitem> +<para>delete letter the cursor is on</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>dd</command></term> + +<listitem> +<para>delete the entire line (even if it wraps on the screen)</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>i</command></term> + +<listitem> +<para>insert text at the cursor</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>a</command></term> + +<listitem> +<para>insert text after the cursor</para> + +</listitem> +</varlistentry> +</variablelist> +Once you type <command>i</command> or <command>a</command>, you can enter text. +<command>Esc</command> puts you back in command mode where you can type +<variablelist> +<varlistentry><term><command>:w</command></term> +<listitem> +<para>to write your changes to disk and continue editing</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>:wq</command></term> + +<listitem> +<para>to write and quit</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>:q!</command></term> + +<listitem> +<para>to quit without saving changes</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>/<replaceable>text</replaceable></command></term> + +<listitem> +<para>to move the cursor to <replaceable>text</replaceable>; +<command>/<keycap>Enter</keycap></command> (the enter key) to find +the next instance of <replaceable>text</replaceable>.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>G</command></term> + +<listitem> +<para>to go to the end of the file</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command><replaceable>n</replaceable>G</command></term> + +<listitem> +<para>to go to line <replaceable>n</replaceable> in +the file, where <replaceable>n</replaceable> is a number</para> + +</listitem> +</varlistentry> + +<varlistentry><term><keycombo><keycap>Ctrl</><keycap>L</></keycombo></term> + +<listitem> +<para>to redraw the screen</para> + +</listitem> +</varlistentry> + +<varlistentry><term><keycombo><keycap>Ctrl</><keycap>b</></> and <keycombo><keycap>Ctrl</><keycap>f</></></term> + +<listitem> +<para>go back +and forward a screen, as they +do with <command>more</> and <command>view</>.</para> + +</listitem> +</varlistentry> +</variablelist> +</para> + +<para>Practice with <command>vi</> in your home directory by creating +a new file with <command>vi <replaceable>filename</></> and adding +and deleting text, saving the file, and calling it up again. +<command>vi</> delivers some surprises because it's really quite +complex, and sometimes you'll inadvertently issue a command that will +do something you don't expect. (Some people actually like +<command>vi</>—it's more powerful than DOS EDIT—find out +about the <command>:r</> command.) Use <keycap>Esc</> one or +more times to be sure you're in command mode and proceed from there +when it gives you trouble, save often with <command>:w</>, and +use <command>:q!</> to get out and start over (from +your last <command>:w</>) when you need to.</para> + +<para>Now you can <command>cd</> to <filename>/etc</filename>, +<command>su</> to root, use <command>vi</> to edit the file +<filename>/etc/group</filename>, and add a user to wheel so the user +has root privileges. Just add a comma and the user's login name to +the end of the first line in the file, press <keycap>Esc</>, and use +<command>:wq</> to write the file to disk and quit. Instantly +effective. (You didn't put a space after the comma, did you?)</para> + +</chapter> + +<chapter> +<title>Printing Files from DOS</title> + +<para>At this point you probably don't have the printer working, so here's a +way to create a file from a man 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 the command +man chmod to read about it. The command +<informalexample> +<screen># <userinput>man chmod > chmod.txt</></screen> +</informalexample> +will send the man page to the <filename>chmod.txt</filename> file +instead of showing it on your screen. Now put a dos-formatted +diskette in your floppy drive a, <command>su</> to +root, and type +<informalexample> +<screen># <userinput>/sbin/mount -t msdos /dev/fd0 /mnt</></screen> +</informalexample> +to mount the floppy drive on <filename>/mnt</filename>.</para> + +<para>Now (you no longer need to be root, and you can type +<command>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: +<informalexample> +<screen>% <userinput>cp chmod.txt /mnt</></screen> +</informalexample> +and use <command>ls /mnt</command> to get a directory listing of +<filename>/mnt</filename>, which should show the file +<filename>chmod.txt</filename>.</para> + +<para>You might especially want to make a file from +<filename>/sbin/dmesg</filename> by typing +<informalexample> +<screen>% <userinput>/sbin/dmesg > dmesg.txt</></screen> +</informalexample> +and copying <filename>dmesg.txt</filename> to the floppy. +<command>/sbin/dmesg</command> is the boot log record, and it's +useful to understand it because it shows what FreeBSD found when it +booted up. If you ask questions on +<email>freebsd-questions@FreeBSD.ORG</> or on a USENET +group—like <quote>FreeBSD isn't finding my tape drive, what do +I do?</quote>—people will want to know what <command>dmesg</> +has to say.</para> + +<para>You can now dismount the floppy drive (as root) to get the disk +out with +<informalexample> +<screen># <userinput>/sbin/umount /mnt</></screen> +</informalexample> +and reboot to go to DOS. Copy these files to a DOS directory, call +them up with DOS EDIT, Windows Notepad, 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! man pages come out best if +printed with the dos <command>print</> command. (Copying files from +FreeBSD to a mounted dos partition is in some cases still a little +risky.)</para> + +<para>Getting the printer printing from FreeBSD involves creating an +appropriate entry in <filename>/etc/printcap</filename> and creating +a matching spool directory in +<filename>/var/spool/output</filename>. If your printer is on +<hardware>lpt0</> (what dos calls <hardware>LPT1</>), you may only +need to go to <filename>/var/spool/output</filename> and (as root) +create the directory <filename>lpd</> by typing: +<informalexample> +<screen># <userinput>mkdir lpd</></screen> +</informalexample> +Then the printer should respond if it's 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 <ulink +URL="http://www.freebsd.org/handbook/handbook.html">FreeBSD +handbook.</></para> + +</chapter> + +<chapter> +<title>Other Useful Commands</title> + +<para> +<variablelist> +<varlistentry><term><command>df</></term> +<listitem> +<para>shows file space and mounted systems.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ps aux</></term> + +<listitem> +<para>shows processes running. <command>ps ax</> is a narrower form.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>rm <replaceable>filename</></></term> + +<listitem> +<para>remove <replaceable>filename</>.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>rm -R <replaceable>dir</></></term> + +<listitem> +<para>removes a directory <replaceable>dir</> and all +subdirectories—careful!</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls -R</command></term> + +<listitem> +<para>lists files in the current +directory and all subdirectories; +I used a variant, <command>ls -AFR > where.txt</command>, +to get a list of all +the files in <filename>/</filename> and (separately) +<filename>/usr</filename> before I found better +ways to find files.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>passwd</></term> + +<listitem> +<para>to change user's password (or root's password)</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>man hier</></term> + +<listitem> +<para>man page on the Unix file system</para> + +</listitem> +</varlistentry> +</variablelist></para> + +<para>Use <command>find</> to locate filename in <filename>/usr</filename> +or any of its subdirectories with +<informalexample> +<screen>% <userinput>find /usr -name "<replaceable>filename</>"</></screen> +</informalexample> +You can use <literal>*</literal> as a wildcard in +<parameter>"<replaceable>filename</>"</> (which should be in +quotes). If you tell find to search in <filename>/</filename> +instead of <filename>/usr</filename> it will look for the file(s) on +all mounted file systems, including the CDROM and the dos +partition.</para> + +<para>An excellent book that explains Unix commands and utilities is +Abrahams & Larson, <citetitle>Unix for the Impatient</citetitle> +(2nd ed., Addison-Wesley, 1996). There's also a lot of Unix +information on the Internet. Try the <ulink +URL="http://www.eecs.nwu.edu/unix.html">Unix Reference +Desk</ulink>.</para> + +</chapter> + +<chapter> +<title>Next Steps</title> + +<para>You should now have the tools you need to get around and edit +files, so you can get everything up and running. There is a great +deal of information in the FreeBSD handbook (which is probably on +your hard drive) and <ulink URL="http://www.freebsd.org/">FreeBSD's +web site</ulink>. A wide variety of packages and ports are on the +<ulink URL="http://www.cdrom.com/">Walnut Creek</ulink> CDROM as well +as the web site. The handbook tells you more about how to use them +(get the package if it exists, with <command>pkg_add +/cdrom/packages/All/<replaceable>packagename</></>, +where <replaceable>packagename</replaceable> is the filename of the +package). The cdrom has lists of the packages and ports with brief +descriptions in <filename>cdrom/packages/index</filename>, +<filename>cdrom/packages/index.txt</filename>, and +<filename>cdrom/ports/index</filename>, with fuller descriptions in +<filename>/cdrom/ports/*/*/pkg/DESCR</filename>, where the +<literal>*</literal>s represent subdirectories of kinds of programs +and program names respectively.</para> + +<para>If you find the handbook too sophisticated (what with +<command>lndir</> and all) on installing ports from the cdrom, +here's what usually works:</para> + +<para>Find the port you want, say <command>kermit</>. There will be +a directory for it on the cdrom. Copy the subdirectory to +<filename>/usr/local</filename> (a good place for software you add +that should be available to all users) with: +<informalexample> +<screen># <userinput>cp -R /cdrom/ports/comm/kermit /usr/local</></screen> +</informalexample> + +This should result in a <filename>/usr/local/kermit</filename> +subdirectory that has all the files that the +<command>kermit</command> subdirectory on the CDROM has.</para> + +<para>Next, check <filename>/cdrom/ports/distfiles</filename> for a +file with a name that indicates it's the port you want. Copy that +file to <filename>/usr/ports/distfiles</filename>. (Create +<filename>/usr/ports/distfiles</filename> if it doesn't exist using +<command>mkdir</>.) In the case of <command>kermit</>, there is no +distfile.</para> + +<para>Then <command>cd</> to the subdirectory of +<filename>/usr/local/kermit</filename> that has the file +<filename>Makefile</>. Type +<informalexample> +<screen># <userinput>make all install</></screen> +</informalexample> +</para> + +<para>During this process the port will ftp to get any compressed +files it needs that it didn't find in +<filename>/usr/ports/distfiles</filename>. If you don't have your +network running yet and there was no file for the port in +<filename>/cdrom/ports/distfiles</filename>, you will have to get +the distfile using another machine and copy it to +<filename>/usr/ports/distfiles</filename> from a floppy or your dos +partition. Read <filename>Makefile</> (with <command>cat</> or +<command>more</> or <command>view</>) to find out where to go (the +master distribution site) to get the file and what its name is. Its +name will be truncated when downloaded to DOS, and after you get it +into <filename>/usr/ports/distfiles</filename> you'll have to rename +it (with the <command>mv</> command) to its original name so it can +be found. (Use binary file transfers!) Then go back to +<filename>/usr/local/kermit</filename>, find the directory with +<filename>Makefile</>, and type <command>make all install</>.</para> + +<para>The other thing that happens when installing ports or packages +is that some other program is needed. If the installation stops with +a message <errorname>can't find unzip</errorname> or whatever, you +might need to install the package or port for unzip before you +continue.</para> + +<para>Once it's installed type <command>rehash</> to make FreeBSD +reread the files in the path so it knows what's there. (If you get a +lot of <errorname>path not found</> messages when you use +<command>whereis</> or which, you might want to make additions to the +list of directories in the path statement in +<filename>.cshrc</filename> in your home directory. The path +statement in Unix does the same kind of work it does in DOS, except +the current directory is not (by default) in the path for security +reasons; if the command you want is in the directory you're in, you +need to type <filename>./</filename> before the command to make it +work; no space after the slash.)</para> + +<para>You might want to get the most recent version of Netscape from +their <ulink URL="ftp://ftp.netscape.com">ftp site</ulink>. (Netscape +requires the X Window System.) The version you want is the +<quote>unknown bsd</quote> version. Just use <command>gunzip +<replaceable>filename</></> and <command>tar xvf +<replaceable>filename</></> on it, move the binary to +<filename>/usr/local/bin</filename> or some other place binaries are +kept, <command>rehash</>, and then put the following lines in +<filename>.cshrc</filename> in each user's home directory or (easier) +in <filename>/etc/csh.cshrc</filename>, the system-wide csh start-up +file: +<informalexample> +<programlisting>setenv XKEYSYMDB /usr/X11R6/lib/X11/XKeysymDB +setenv XNLSPATH /usr/X11R6/lib/X11/nls</> +</informalexample> +This assumes that the file <filename>XKeysymDB</> and the directory +<filename>nls</> are in <filename>/usr/X11R6/lib/X11</filename>; if +they're not, find them and put them there.</para> + +<para>If you originally got Netscape as a port using the CDROM (or +ftp), don't replace <filename>/usr/local/bin/netscape</filename> with +the new netscape binary; this is just a shell script that sets up the +environmental variables for you. Instead rename the new binary to +<filename>netscape.bin</filename> and replace the old binary, which +is <filename>/usr/local/lib/netscape/netscape.bin</filename>.</para> + +</chapter> + +<chapter> +<title>Other</title> + +<para>As root, you can dismount the CDROM with <command>/sbin/umount +/cdrom</>, take it out of the drive, insert another one, and mount it +with <command>/sbin/mount_cd9660 /dev/cd0a /cdrom</> assuming +<hardware>cd0a</> is the device name for your CDROM drive.</para> + +<para>Using the live file system—the second of FreeBSD's CDROM +disks—is useful if you've got limited space. You might try +using <command>emacs</> or playing games from the cdrom. This +involves using <command>lndir</>, which gets installed with the X +Window System, to tell the program(s) where to find the necessary +files, because they're in the <filename>/cdrom</filename> file system +instead of in <filename>/usr</filename> and its subdirectories, which +is where they're expected to be. Read <command>man lndir</>.</para> + +<para>You can delete a user (say, jack) by using the command +<command>vipw</> to bring up the <filename>master.passwd</filename> +file (do not use <command>vi</> directly on master.passwd); delete +the line for jack and save the file. Then edit +<filename>/etc/group</filename>, eliminating jack wherever it +appears. Finally, go to <filename>/usr/home</filename> and use +<command>rm -R</command> jack (to get rid of user jack's home +directory files).</para> + +</chapter> + +<chapter> +<title>Comments Welcome</title> + +<para>If you use this guide I'd be interested in knowing where it was +unclear and what was left out that you think should be included, and +if it was helpful. My thanks to Eugene W. Stark, professor of +computer science at SUNY-Stony Brook, and John Fieber for helpful +comments.</para> + +<para>Annelise Anderson, <email>andrsn@hoover.stanford.edu</></para> + +</chapter> +</book> diff --git a/en/tutorials/newuser/newuser.sgml b/en/tutorials/newuser/newuser.sgml deleted file mode 100644 index e63d0acfb5..0000000000 --- a/en/tutorials/newuser/newuser.sgml +++ /dev/null @@ -1,538 +0,0 @@ -<!DOCTYPE linuxdoc PUBLIC "-//FreeBSD//DTD linuxdoc//EN"> -<!-- $Id: newuser.sgml,v 1.5 1996-12-31 22:31:13 mpp Exp $ --> - -<article> -<title>For People New to Both FreeBSD and Unix</title> -<author>Annelise Anderson - <htmlurl url="mailto:andrsn@hoover.stanford.edu" - name="<andrsn@hoover.stanford.edu>"> -<date>June 30, 1996 - -<abstract>Congratulations on installing FreeBSD! -This introduction is for people new to both FreeBSD -<em>and</em> Un*x—so it starts with basics. It assumes you're using -version 2.0.5 or later of FreeBSD as distributed by Walnut Creek -or FreeBSD.ORG, your system (for now) has a single user -(you)—and you're probably pretty good with DOS/Windows or OS/2. -</abstract> - -<toc> - -<!-- ************************************************************ --> -<sect>Logging in and Getting Out - -<p>Log in (when you see <tt>login:</tt>) as a user you created during -installation or as <em>root</em>. (Your FreeBSD installation will already -have an account for root; root can go anywhere and do anything, -including deleting essential files, so be careful!) - -To log out (and get a new <tt>login</tt> prompt) type -<tscreen> -exit -</tscreen> -as often as necessary. Yes, press <em>enter</em> after commands, and remember -that Unix is case-sensitive—<tt>exit</tt>, not <tt>EXIT</tt>. - -To shut down the machine type: -<tscreen> -/sbin/shutdown -h now -</tscreen> -Or to reboot type -<tscreen> -/sbin/shutdown -r now -</tscreen> -or -<tscreen> -/sbin/reboot -</tscreen> -You can also reboot with -<tt>Ctrl-Alt-Delete</tt>. Give it a little time to do its work. This is -equivalent to <tt>/sbin/reboot</tt> in recent releases of FreeBSD, and is -much, much better than hitting the reset button. You don't want to -have to reinstall this thing, do you? - -<!-- ************************************************************ --> -<sect>Adding A User with Root Privileges - -<p>If you didn't create any users when you installed the system and -are thus logged in as root, you should probably create a user now with -<tscreen> -adduser -</tscreen> -Don't use the <tt>-verbose</tt> option; the defaults are what you -want. Suppose you create a user <em>jack</em> with full name -<em>Jack Benimble</em>. Give jack a password if security (even -kids around who might pound on the keyboard) is an issue. When -it asks you if you want to invite jack into other groups, type -<tscreen> -wheel -</tscreen> -This will make it possible to log in as <em>jack</em> and use the <tt>su</tt> command to -become root. Then you won't get scolded any more for logging in as -root, and as root you'll have the same environment as jack -(this is good). - -You can quit <tt>adduser</tt> any time by typing <tt>Ctrl-C</tt>, and at the end -you'll have a chance to approve your new user or simply type <tt>n</tt> for no. -You might want to create a second new user (jill?) so that when you edit -jack's login files, you'll have a hot spare in case something goes wrong. - -Once you've done this, use <tt>exit</tt> to get back to a login prompt and log -in as <em>jack</em>. In general, it's a good idea to do as -much work as possible as an ordinary user who doesn't have the -power—and risk—of root. - -If you already created a user and you want the user to be able to <tt>su</tt> -to root, you can log in as root and edit the file <tt>/etc/group</tt>, adding -jack to the first line (the group wheel). But first you need to -practice <tt>vi</tt>, the text editor. - -<!-- ************************************************************ --> -<sect>Looking Around - -<p>Logged in as an ordinary user, look around and try out some commands that -will access the sources of help and information within FreeBSD. - -Here are some commands and what they do: -<descrip> -<tag/<tt>id</tt>/ Tells you who you are! -<tag/<tt>pwd</tt>/ Shows you where you are—the current - working directory. -<tag/<tt>ls</tt>/ Lists the files in the current directory. -<tag/<tt>ls -F</tt>/ Lists the files in the current directory - with a * after - executables, a / after directories, and an @ after symbolic - links. -<tag/<tt>ls -l</tt>/ Lists the files in long format—size, - date, permissions. -<tag/<tt>ls -a</tt>/ Lists hidden (unless you're root) ``dot'' - files with the others. -<tag/<tt>cd</tt>/ Changes directories. <tt>cd ..</tt> backs up - one level; note the - space after <tt>cd</tt>. <tt>cd /usr/local</tt> - goes there. <tt>cd ~</tt> goes to - the home directory of the person logged in—e.g., - <tt>/usr/home/jack</tt>. Try <tt>cd /cdrom</tt>, - and then <tt>ls</tt>, to find out - if your CDROM is mounted and working. -<tag/<tt>view <em>filename</em></tt>/ - Lets you look at a file (named <em>filename</em> - without changing - it. Try <tt>view /etc/fstab</tt>. <tt>:q</tt> to quit. -<tag/<tt>cat <em>filename</em></tt>/ - Displays <em>filename</em> on screen. If it's too long and you - can see only the end of it, press <tt>ScrollLock</tt> and use - the <tt>up-arrow</tt> to move backward; you can - use <tt>ScrollLock</tt> with - man pages too. Press <tt>ScrollLock</tt> again - to quit scrolling. - You might want to try <tt>cat</tt> on some of the - dot files in your - home directory—<tt>cat .cshrc</tt>, <tt>cat .login</tt>, - <tt>cat .profile</tt>. -</descrip> -You'll notice aliases in <tt>.cshrc</tt> -for some of the <tt>ls</tt> commands (they're very convenient). You can create -other aliases by editing <tt>.cshrc</tt>. You can make these aliases -available to all users on the system by putting them in the system-wide -csh configuration file, <em>/etc/csh.cshrc</em>. - -<!-- ************************************************************ --> -<sect>Getting Help and Information - -<p>Here are some useful sources of help. ``text'' stands for something of -your choice that you type in—usually a command or filename. -<descrip> -<tag/<tt>apropos <em>text</em></tt>/ - Everything containing string <em>text</em> - in the whatis database. -<tag/<tt>man <em>text</em></tt>/ - The man page for <em>text</em>. - The major source of documentation - for Un*x systems. <tt>man ls</tt> will tell you - all the ways to - use the <tt>ls</tt> command. Press <tt>Enter</tt> to - move through text, <tt>Ctrl-b</tt> - to go back a page, <tt>Ctrl-f</tt> to go forward, - <tt>q</tt> or <tt>Ctrl-c</tt> to quit. -<tag/<tt>which <em>text</em></tt>/ - Tells you where in the user's path the command - <em>text</em> is found. -<tag/<tt>locate <em>text</em></tt>/ - All the paths where the string <tt>text</tt> is found. -<tag/<tt>whatis <em>text</em></tt>/ - Tells you what the command <tt>text</tt> does and its man page. -<tag/<tt>whereis <em>text</em></tt>/ - Finds the file <em>text</em>, giving its full path. -</descrip> - -You might want to try using <tt>whatis</tt> on some common useful -commands like <tt>cat</tt>, <tt>more</tt>, <tt>grep</tt>, -<tt>mv</tt>, <tt>find</tt>, <tt>tar</tt>, <tt>chmod</tt>, -<tt>chown</tt>, <tt>date</tt>, and <tt>script</tt>. -<tt>more</tt> lets you read a page at a time as it does in DOS, -e.g., <tt>ls -l | more</tt> or <tt>more <em>filename</em></tt>. The -<tt>*</tt> works as a wildcard—e.g., <tt>ls w*</tt> will show -you files beginning with w. - -Are some of these not working very well? Both <tt>locate</tt> -and <tt>whatis</tt> depend on a database that's rebuilt weekly. -If your machine isn't going to be left on over the weekend (and -running FreeBSD), you might want to run the commands for daily, -weekly, and monthly maintenance now and then. Run them as root -and give each one time to finish before you start the next one, -for now. -<tscreen> -/etc/daily<newline> -/etc/weekly<newline> -/etc/monthly -</tscreen> -If you get tired waiting, press <tt>Alt-F2</tt> to get another -virtual console, and log in again. After all, it's a multi-user, -multi-tasking system. Nevertheless these commands will probably -flash messages on your screen while they're running; you can type -<tt>clear</tt> at the prompt to clear the screen. Once they've run, you -might want to look at <tt>/var/mail/root</tt> and -<tt>/var/log/messages</tt>. - -Basically running such commands is part of system administration—and as -a single user of a Unix system, you're your own system administrator. -Virtually everything you need to be root to do is system administration. -Such responsibilities aren't covered very well even in those big fat books -on Unix, which seem to devote a lot of space to pulling down menus in -windows managers. You might want to get one of the two leading books -on systems administration, either Evi Nemeth et.al.'s <em>UNIX System -Administration Handbook</em> (Prentice-Hall, 1995, ISBN 0-13-15051-7)—the -second edition with the red cover; or Æleen Frisch's <em>Essential System -Administration</em> (O'Reilly & Associates, 1993, ISBN 0-937175-80-3). -I used Nemeth. - -<!-- ************************************************************ --> -<sect>Editing Text - -<p>To configure your system, you need to edit text files. Most -of them will be in the <tt>/etc</tt> directory; and you'll need -to <tt>su</tt> to root to be able to change them. The text -editor is <tt>vi</tt>. Before you edit a file, you should -probably back it up. Suppose you want to edit -<tt>/etc/sysconfig</tt>. You could just use <tt>cd /etc</tt> to -get to the <tt>/etc</tt> directory and do: -<tscreen> -cp sysconfig sysconfig.orig -</tscreen> -This would copy <tt>sysconfig</tt> to <tt>sysconfig.orig</tt>, -and you could later copy <tt>sysconfig.orig</tt> to -<tt>sysconfig</tt> to recover the original. But even better -would be moving (renaming) and then copying back: -<tscreen> -mv sysconfig sysconfig.orig<newline> -cp sysconfig.orig sysconfig -</tscreen> -because the <tt>mv</tt> command preserves the original date and -owner of the file. You can now edit <tt>sysconfig</tt>. If you -want the original back, you'd then <tt>mv sysconfig syconfig.myedit</tt> -(assuming you want to preserve your edited version) and then -<tscreen> -mv sysconfig.orig sysconfig -</tscreen> -to put things back the way they were. - -To edit a file, type -<tscreen> -vi filename -</tscreen> -Move through the text with the arrow keys. <tt>Esc</tt> (the -escape key) puts <tt>vi</tt> in command mode. Here are some -commands: -<descrip> - <tag/<tt>x</tt>/ delete letter the cursor is on - <tag/<tt>dd</tt>/ delete the entire line (even if - it wraps on the screen) - <tag/<tt>i</tt>/ insert text at the cursor - <tag/<tt>a</tt>/ insert text after the cursor -</descrip> -Once you type <tt>i</tt> or <tt>a</tt>, you can enter text. -<tt>Esc</tt> puts you back in command mode where you can type -<descrip> - <tag/<tt>:w</tt>/ to write your changes to disk and continue editing - <tag/<tt>:wq</tt>/ to write and quit - <tag/<tt>:q!</tt>/ to quit without saving changes - <tag><tt>/<em>text</em></tt></tag> to move the cursor - to <em>text</em>; <tt>/Enter</tt> (the enter - key) to find the next instance of <em>text</em>. - <tag/<tt>G</tt>/ to go to the end of the file - <tag/<tt><em>n</em>G</tt>/ to go to line <em>n</em> in - the file, where <em>n</em> is a number - <tag/<tt>Ctrl-L</tt>/ to redraw the screen - <tag/<tt>Ctrl-b</tt> and <tt>Ctrl-f</tt>/ go back - and forward a screen, as they - do with <tt>more</tt> and <tt>view</tt>. -</descrip> - -Practice with <tt>vi</tt> in your home directory by creating a -new file with <tt>vi filename</tt> and adding and deleting text, -saving the file, and calling it up again. <tt>vi</tt> delivers -some surprises because it's really quite complex, and sometimes -you'll inadvertently issue a command that will do something you -don't expect. (Some people actually like <tt>vi</tt>—it's more -powerful than DOS EDIT—find out about the <tt>:r</tt> command.) -Use <tt>Esc</tt> one or more times to be sure you're in command -mode and proceed from there when it gives you trouble, save often -with <tt>:w</tt>, and use <tt>:q!</tt> to get out and start over -(from your last <tt>:w</tt>) when you need to. - -Now you can <tt>cd</tt> to <tt>/etc</tt>, <tt>su</tt> to root, -use <tt>vi</tt> to edit the file <tt>/etc/group</tt>, and add a -user to wheel so the user has root privileges. Just add a comma -and the user's login name to the end of the first line in the -file, press <tt>Esc</tt>, and use <tt>:wq</tt> to write the file -to disk and quit. Instantly effective. (You didn't put a space -after the comma, did you?) - -<!-- ************************************************************ --> -<sect>Printing Files from DOS - -<p>At this point you probably don't have the printer working, so here's a -way to create a file from a man 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 the command -man chmod to read about it. The command -<tscreen> -man chmod > chmod.txt -</tscreen> -will send the man page to the <tt>chmod.txt</tt> file instead of showing it on -your screen. Now put a dos-formatted diskette in your floppy drive a, -<tt>su</tt> to root, and type -<tscreen> -/sbin/mount -t msdos /dev/fd0 /mnt -</tscreen> -to mount the floppy drive on <tt>/mnt</tt>. - -Now (you no longer need to be root, and you can type <tt>exit</tt> 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: -<tscreen> -cp chmod.txt /mnt -</tscreen> -and use <tt>ls /mnt</tt> to get a directory listing of -<tt>/mnt</tt>, which should show the file <tt>chmod.txt</tt>. - -You might especially want to make a file from <tt>/sbin/dmesg</tt> by typing -<tscreen> -/sbin/dmesg > dmesg.txt -</tscreen> -and copying <tt>dmesg.txt</tt> to the floppy. <tt>/sbin/dmesg</tt> is the boot - log record, -and it's useful to understand it because it shows what FreeBSD found -when it booted up. If you ask questions on freebsd-questions@FreeBSD.ORG or on -a USENET group—like ``FreeBSD isn't finding my tape drive, what do I -do?''—people will want to know what <tt>dmesg</tt> has to say. - -You can now dismount the floppy drive (as root) to get the disk out with -<tscreen> -/sbin/umount /mnt -</tscreen> -or reboot to go to DOS. Copy these files to a DOS directory, call them -up with DOS EDIT, Windows Notepad, 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! man pages come out best if printed -with the dos <tt>print</tt> 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 <tt>/etc/printcap</tt> and creating -a matching spool directory in <tt>/var/spool/output</tt>. If your -printer is on lpt0 (what dos calls LPT1), you may only need to -go to <tt>/var/spool/output</tt> and (as root) create the directory -lpd by typing: - -<tscreen> -mkdir lpd -</tscreen> -Then the printer should respond if it's 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. -<!-- ************************************************************ --> -<sect>Other Useful Commands - -<p><descrip> -<tag/<tt>df</tt>/ shows file space and mounted systems. -<tag/<tt>ps aux</tt>/ shows processes running. <tt>ps ax</tt> is a narrower form. -<tag/<tt>lsdev</tt>/ lists configured devices -<tag/<tt>devmenu</tt>/ a menu of devices—in color! -<tag/<tt>rm <em>filename</em></tt>/ remove <tt>filename</tt> -<tag/<tt>rm -R <em>dir</em></tt>/ removes a directory <tt>dir</tt> and all - subdirectories—careful! -<tag/<tt>ls -R</tt>/ lists files in the current - directory and all subdirectories; - I used a variant, <tt>ls -AFR > where.txt</tt>, - to get a list of all - the files in <tt>/</tt> and (separately) - <tt>/usr</tt> before I found better - ways to find files. -<tag/<tt>passwd</tt>/ to change user's password (or root's password) -<tag/<tt>man hier</tt>/ man page on the Unix file system -</descrip> -Use find to locate filename in <tt>/usr</tt> or any of its subdirectories with -<tscreen> -find /usr -name "<em>filename</em>" -</tscreen> -You can use <tt>*</tt> as a wildcard in <tt>"<em>filename</em>"</tt> -(which should be in quotes). If you tell find to search in -<tt>/</tt> instead of <tt>/usr</tt> it will look for the file(s) -on all mounted file systems, including the CDROM and the dos -partition. - -An excellent book that explains Unix commands and utilities is -Abrahams & Larson, <em>Unix for the Impatient</em> (2nd ed., -Addison-Wesley, 1996). There's also a lot of Unix information on -the Internet. Try the <url -url="http://www.eecs.nwu.edu/unix.html" name="Unix Reference -Desk">. - -<!-- ************************************************************ --> -<sect>Next Steps - -<p>You should now have the tools you need to get around and edit -files, so you can get everything up and running. There is a -great deal of information in the FreeBSD handbook (which is -probably on your hard drive) and <url -url="http://www.freebsd.org" name="FreeBSD's web site">. A wide -variety of packages and ports are on the <htmlurl -url="http://www.cdrom.com" name="Walnut Creek"> CDROM as well as -the web site. The handbook tells you more about how to use them -(get the package if it exists, with <tt>pkg_add -/cdrom/packages/All/<em>packagename</em></tt>, where -<em>packagename</em> is the filename of the package). The cdrom -has lists of the packages and ports with brief descriptions in -<tt>cdrom/packages/index</tt>, <tt>cdrom/packages/index.txt</tt>, -and <tt>cdrom/ports/index</tt>, with fuller descriptions in -<tt>/cdrom/ports/*/*/pkg/DESCR</tt>, where the <tt>*</tt>s -represent subdirectories of kinds of programs and program names -respectively. - -If you find the handbook too sophisticated (what with -<tt>lndir</tt> and all) on installing ports from the cdrom, -here's what usually works: - -Find the port you want, say <tt>kermit</tt>. There will be a directory -for it on the cdrom. Copy the subdirectory to -<tt>/usr/local</tt> (a good place for software you add that -should be available to all users) with: -<tscreen> -cp -R /cdrom/ports/comm/kermit /usr/local -</tscreen> -This should result in a <tt>/usr/local/kermit</tt> subdirectory -that has all the files that the <tt>kermit</tt> subdirectory on -the CDROM has. - -Next, check <tt>/cdrom/ports/distfiles</tt> for a file with a name -that indicates it's the port you want. Copy that file to -<tt>/usr/ports/distfiles</tt>. (Create <tt>/usr/ports/distfiles</tt> -if it doesn't exist using <em>mkdir</em>.) In the case of <tt>kermit</tt>, -there is no distfile. - -Then <tt>cd</tt> to the subdirectory of -<tt>/usr/local/kermit</tt> that has the file Makefile. Type -<tscreen> -make all install -</tscreen> - -During this process the port will ftp to get any compressed files it -needs that it didn't find in <tt>/usr/ports/distfiles</tt>. If you -don't have your network running yet and there was no file for the -port in <tt>/cdrom/ports/distfiles</tt>, you will have to get the -distfile using another machine and copy it to -<tt>/usr/ports/distfiles</tt> from a floppy or your dos partition. -Read <tt>Makefile</tt> (with <tt>cat</tt> or <tt>more</tt> or -<tt>view</tt>) to find out where to go (the master distribution site) -to get the file and what its name is. Its name will be truncated -when downloaded to DOS, and after you get it into -<tt>/usr/ports/distfiles</tt> you'll have to rename it (with the -<tt>mv</tt> command) to its original name so it can be found. (Use -binary file transfers!) Then go back to <tt>/usr/local/kermit</tt>, -find the directory with <tt>Makefile</tt>, and type <tt>make all -install</tt>. - -The other thing that happens when installing ports or packages is that -some other program is needed. If the installation stops with a message -"can't find unzip" or whatever, you might need to install the package -or port for unzip before you continue. - -Once it's installed type <tt>rehash</tt> to make FreeBSD -<tt>reread</tt> the files in the path so it knows what's there. -(If you get a lot of "path not found" messages when you use -<tt>whereis</tt> or which, you might want to make additions to -the list of directories in the path statement in <tt>.cshrc</tt> -in your home directory. The path statement in Unix does the same -kind of work it does in DOS, except the current directory is not -(by default) in the path for security reasons; if -the command you want is in the directory you're in, you need to -type <tt>./</tt> before the command to make it work; no space after the -slash.) - -You might want to get the most recent version of Netscape from their -<url url="ftp://ftp.netscape.com" name="ftp site">. (Netscape -requires the X Window System.) The version you want is the "unknown -bsd" version. Just use <tt>gunzip <em>filename</em></tt> and <tt>tar -xvf <em>filename</em></tt> on it, move the binary to -<tt>/usr/local/bin</tt> or some other place binaries are kept, -<tt>rehash</tt>, and then put the following lines in <tt>.cshrc</tt> -in each user's home directory or (easier) in -<tt>/etc/csh.cshrc</tt>, the system-wide csh start-up file: -<tscreen> -setenv XKEYSYMDB /usr/X11R6/lib/X11/XKeysymDB<newline> -setenv XNLSPATH /usr/X11R6/lib/X11/nls -</tscreen> -This assumes that the file <tt>XKeysymDB</tt> and the directory -<tt>nls</tt> are in -<tt>/usr/X11R6/lib/X11</tt>; if they're not, find them and put them there. - -If you originally got Netscape as a port using the CDROM (or ftp), -don't replace <tt>/usr/local/bin/netscape</tt> with the new netscape binary; -this is just a shell script that sets up the environmental variables -for you. Instead rename the new binary to <tt>netscape.bin</tt> and replace the - old -binary, which is <tt>/usr/local/lib/netscape/netscape.bin</tt>. - - -<!-- ************************************************************ --> -<sect>Other - -<p>As root, you can dismount the CDROM with <tt>/sbin/umount -/cdrom</tt>, take it out of the drive, insert another one, and -mount it with <tt>/sbin/mount_cd9660 /dev/cd0a /cdrom</tt> -assuming <tt>cd0a</tt> is the device name for your CDROM drive. - -Using the live file system—the second of FreeBSD's CDROM disks—is -useful if you've got limited space. You might try using -<tt>emacs</tt> or playing games from the cdrom. This involves using -<tt>lndir</tt>, which gets installed with the X Window System, to tell the -program(s) where to find the necessary files, because they're in the -<tt>/cdrom</tt> file system instead of in <tt>/usr</tt> and its -subdirectories, which is where they're expected to be. Read <tt>man -lndir</tt>. - -You can delete a user (say, jack) by using the command <tt>vipw</tt> -to bring up the <tt>master.passwd</tt> file (do not use vi directly -on master.passwd); delete the line for jack and save the file. Then -edit <tt>/etc/group</tt>, eliminating jack wherever it appears. -Finally, go to <tt>/usr/home</tt> and use <tt>rm -R</tt> jack (to -get rid of user jack's home directory files). - -<!-- ************************************************************ --> -<sect>Comments Welcome - -<p>If you use this guide I'd be interested in knowing where it was -unclear and what was left out that you think should be included, and -if it was helpful. My thanks to Eugene W. Stark, professor of -computer science at SUNY-Stony Brook, and John Fieber for helpful -comments. - -Annelise Anderson <htmlurl url="mailto:andrsn@hoover.stanford.edu" - name="<andrsn@hoover.stanford.edu>"> - -</article> - - diff --git a/en_US.ISO8859-1/articles/new-users/Makefile b/en_US.ISO8859-1/articles/new-users/Makefile index d8d8509284..a0f6762443 100644 --- a/en_US.ISO8859-1/articles/new-users/Makefile +++ b/en_US.ISO8859-1/articles/new-users/Makefile @@ -1,5 +1,5 @@ -DOC= newuser -SRCS= newuser.sgml +DOCS= newuser.docb +INDEXLINK= newuser.html -.include <bsd.sgml.mk> +.include "../../web.mk" diff --git a/en_US.ISO8859-1/articles/new-users/article.sgml b/en_US.ISO8859-1/articles/new-users/article.sgml new file mode 100644 index 0000000000..c98403616b --- /dev/null +++ b/en_US.ISO8859-1/articles/new-users/article.sgml @@ -0,0 +1,844 @@ +<!DOCTYPE BOOK PUBLIC "-//Davenport//DTD DocBook V3.0//EN"> +<book> + +<bookinfo> +<bookbiblio> +<title>For People New to Both FreeBSD and Unix</title> + +<authorgroup> +<author> +<firstname>Annelise</firstname> +<surname>Anderson</surname> +<affiliation> +<address><email>andrsn@hoover.stanford.edu</email></address> +</affiliation> +</author> +</authorgroup> + +<pubdate>June 30, 1996</pubdate> + +<abstract><para>Congratulations on installing FreeBSD! This +introduction is for people new to both FreeBSD +<emphasis>and</emphasis> Un*x—so it starts with basics. It +assumes you're using version 2.0.5 or later of FreeBSD as distributed +by Walnut Creek or FreeBSD.ORG, your system (for now) has a single +user (you)—and you're probably pretty good with DOS/Windows or +OS/2.</para></abstract> + +</bookbiblio> +</bookinfo> + +<chapter> +<title>Logging in and Getting Out</title> + +<para>Log in (when you see <systemitem +class=prompt>login:</systemitem>) as a user you created during +installation or as <firstterm>root</firstterm>. (Your FreeBSD +installation will already have an account for root; root can go +anywhere and do anything, including deleting essential files, so be +careful!)</para> + +<para>To log out (and get a new <systemitem class=prompt>login:</systemitem> prompt) type +<informalexample> +<screen># <userinput>exit</userinput></screen> +</informalexample> +as often as necessary. Yes, press <keysym>enter</keysym> after +commands, and remember that Unix is +case-sensitive—<command>exit</command>, not +<command>EXIT</command>.</para> + +<para>To shut down the machine type: +<informalexample> +<screen># <userinput>/sbin/shutdown -h now</userinput></screen> +</informalexample> +Or to reboot type +<informalexample> +<screen># <userinput>/sbin/shutdown -r now</userinput></screen> +</informalexample> +or +<informalexample> +<screen># <userinput>/sbin/reboot</userinput></screen> +</informalexample> +</para> + +<para>You can also reboot with +<keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>Delete</keycap></keycombo>. +Give it a little time to do its work. This is equivalent to +<command>/sbin/reboot</command> in recent releases of FreeBSD, and is +much, much better than hitting the reset button. You don't want to +have to reinstall this thing, do you?</para> + +</chapter> + +<chapter> +<title>Adding A User with Root Privileges</title> + +<para>If you didn't create any users when you installed the system and +are thus logged in as root, you should probably create a user now with +<informalexample> +<screen># <userinput>adduser</userinput></screen> +</informalexample> +Don't use the <option>-verbose</option> option; the defaults are what +you want. Suppose you create a user <emphasis>jack</emphasis> with +full name <emphasis>Jack Benimble</emphasis>. Give jack a password +if security (even kids around who might pound on the keyboard) is an +issue. When it asks you if you want to invite jack into other +groups, type <userinput>wheel</userinput> +<informalexample> +<screen>Login group is ``jack''. Invite jack into other groups: <userinput>wheel</userinput></screen> +</informalexample> +This will make it possible to log in as <emphasis>jack</emphasis> and +use the <command>su</command> command to become root. Then you won't +get scolded any more for logging in as root, and as root you'll have +the same environment as jack (this is good).</para> + +<para>You can quit <command>adduser</command> any time by typing +<keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo>, and at +the end you'll have a chance to approve your new user or simply type +<keycap>n</keycap> for no. You might want to create a +second new user (jill?) so that when you edit jack's login files, +you'll have a hot spare in case something goes wrong.</para> + +<para>Once you've done this, use <command>exit</command> +to get back to a login prompt and log in as +<emphasis>jack</emphasis>. In general, it's a good idea to do as +much work as possible as an ordinary user who doesn't have the +power—and risk—of root.</para> + +<para>If you already created a user and you want the user to be able +to <command>su</command> to root, you can log in as root +and edit the file <filename>/etc/group</filename>, adding jack to the +first line (the group wheel). But first you need to practice +<command>vi</command>, the text editor.</para> + +</chapter> + +<chapter> +<title>Looking Around</title> + +<para>Logged in as an ordinary user, look around and try out some +commands that will access the sources of help and information within +FreeBSD.</para> + +<para>Here are some commands and what they do: +<variablelist> +<varlistentry><term><command>id</command></term> +<listitem> +<para>Tells you who you are!</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>pwd</command></term> + +<listitem> +<para>Shows you where you are—the current +working directory.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls</command></term> + +<listitem> +<para>Lists the files in the current directory.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls <option>-F</option></command></term> + +<listitem> +<para>Lists the files in the current directory with a +<literal>*</literal> after executables, a <literal>/</literal> after +directories, and an <literal>@</literal> after symbolic links.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls <option>-l</option></command></term> + +<listitem> +<para>Lists the files in long format—size, +date, permissions.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls <option>-a</option></command></term> + +<listitem> +<para>Lists hidden (unless you're root) <quote>dot</quote> +files with the others.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>cd</command></term> + +<listitem> +<para>Changes directories. <command>cd +<parameter>..</parameter></command> backs up one level; note the +space after <command>cd</command>. <command>cd +<parameter>/usr/local</parameter></command> goes there. <command>cd +<parameter>~</parameter></command> goes to the home directory of the +person logged in—e.g., <filename>/usr/home/jack</filename>. +Try <command>cd <parameter>/cdrom</parameter></command>, and then +<command>ls</command>, to find out if your CDROM is mounted and +working.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>view <replaceable>filename</replaceable></command></term> + +<listitem> +<para>Lets you look at a file (named +<replaceable>filename</replaceable> without changing it. Try +<command>view <parameter>/etc/fstab</parameter></command>. +<command>:q</command> to quit.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>cat <replaceable>filename</replaceable></command></term> + +<listitem> + +<para>Displays <replaceable>filename</replaceable> on screen. If +it's too long and you can see only the end of it, press +<keycap>ScrollLock</keycap> and use the <keycap>up-arrow</keycap> to +move backward; you can use <keycap>ScrollLock</keycap> with man pages +too. Press <keycap>ScrollLock</keycap> again to quit scrolling. You +might want to try <command>cat</command> on some of the dot files in +your home directory—<command>cat +<parameter>.cshrc</parameter></command>, <command>cat +<parameter>.login</parameter></command>, <command>cat +<parameter>.profile</parameter></command>.</para> + +</listitem> +</varlistentry> +</variablelist> + +You'll notice aliases in <filename>.cshrc</filename> for some of the +<command>ls</command> commands (they're very convenient). +You can create other aliases by editing <filename>.cshrc</filename>. +You can make these aliases available to all users on the system by +putting them in the system-wide csh configuration file, +<filename>/etc/csh.cshrc</filename>.</para> + +</chapter> + +<chapter> +<title>Getting Help and Information</title> + +<para>Here are some useful sources of help. +<replaceable>Text</replaceable> stands for something of your choice +that you type in—usually a command or filename.</para> + +<variablelist> +<varlistentry><term><command>apropos <replaceable>text</replaceable></command></term> + +<listitem> +<para>Everything containing string <replaceable>text</replaceable> +in the <database>whatis database</database>.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>man <replaceable>text</replaceable></command></term> + +<listitem> +<para>The man page for <replaceable>text</replaceable>. The major +source of documentation for Un*x systems. <command>man +<parameter>ls</parameter></command> will tell you all the ways to use +the <command>ls</command> command. Press <keycap>Enter</keycap> to +move through text, +<keycombo><keycap>Ctrl</keycap><keycap>b</keycap></keycombo> to go +back a page, <keycombo><keycap>Ctrl</keycap><keycap>f</keycap></keycombo> to +go forward, <keycap>q</keycap> or +<keycombo><keycap>Ctrl</keycap><keycap>c</keycap></keycombo> to +quit.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>which <replaceable>text</replaceable></command></term> + +<listitem> +<para>Tells you where in the user's path the command +<replaceable>text</replaceable> is found.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>locate <replaceable>text</replaceable></command></term> + +<listitem> +<para>All the paths where the string <replaceable>text</replaceable> +is found.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>whatis <replaceable>text</replaceable></command></term> + +<listitem> +<para>Tells you what the command <replaceable>text</replaceable> +does and its man page.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>whereis <replaceable>text</replaceable></command></term> + +<listitem> +<para>Finds the file <replaceable>text</replaceable>, giving its full +path.</para> +</listitem> +</varlistentry> +</variablelist> + +<para>You might want to try using <command>whatis</command> on some +common useful commands like <command>cat</command>, +<command>more</command>, <command>grep</command>, +<command>mv</command>, <command>find</command>, +<command>tar</command>, <command>chmod</command>, +<command>chown</command>, <command>date</command>, and +<command>script</command>. <command>more</command> lets you read a +page at a time as it does in DOS, e.g., <command>ls -l | +more</command> or <command>more +<replaceable>filename</replaceable></command>. The +<literal>*</literal> works as a wildcard—e.g., <command>ls +w*</command> will show you files beginning with +<literal>w</literal>.</para> + +<para>Are some of these not working very well? Both +<command>locate</command> and <command>whatis</command> +depend on a database that's rebuilt weekly. If your machine isn't +going to be left on over the weekend (and running FreeBSD), you might +want to run the commands for daily, weekly, and monthly maintenance +now and then. Run them as root and give each one time to finish +before you start the next one, for now. +<informalexample> +<screen># <userinput>/etc/daily</userinput> +<lineannotation>output omitted</lineannotation> +# <userinput>/etc/weekly</userinput> +<lineannotation>output omitted</lineannotation> +# <userinput>/etc/monthly</userinput> +<lineannotation>output omitted</lineannotation></screen> +</informalexample></para> + +<para>If you get tired waiting, press +<keycombo><keycap>Alt</keycap><keycap>F2</keycap></keycombo> to get +another <firstterm>virtual console</firstterm>, and log in again. +After all, it's a multi-user, multi-tasking system. Nevertheless +these commands will probably flash messages on your screen while +they're running; you can type <command>clear</command> at the prompt +to clear the screen. Once they've run, you might want to look at +<filename>/var/mail/root</filename> and +<filename>/var/log/messages</filename>.</para> + +<para>Basically running such commands is part of system +administration—and as a single user of a Unix system, you're +your own system administrator. Virtually everything you need to be +root to do is system administration. Such responsibilities aren't +covered very well even in those big fat books on Unix, which seem to +devote a lot of space to pulling down menus in windows managers. You +might want to get one of the two leading books on systems +administration, either Evi Nemeth et.al.'s <citetitle>UNIX System +Administration Handbook</citetitle> (Prentice-Hall, 1995, ISBN +0-13-15051-7)—the second edition with the red cover; or +Æleen Frisch's <citetitle>Essential System +Administration</citetitle> (O'Reilly & Associates, 1993, ISBN +0-937175-80-3). I used Nemeth.</para> + +</chapter> + +<chapter> +<title>Editing Text</title> + +<para>To configure your system, you need to edit text files. Most of +them will be in the <filename>/etc</filename> directory; and you'll +need to <command>su</command> to root to be able to change them. The +text editor is <command>vi</command>. Before you edit a file, you +should probably back it up. Suppose you want to edit +<filename>/etc/sysconfig</filename>. You could just use <command>cd +/etc</command> to get to the <filename>/etc</filename> directory and +do: +<informalexample> +<screen># <userinput>cp sysconfig sysconfig.orig</userinput></screen> +</informalexample> + +This would copy <filename>sysconfig</filename> to +<filename>sysconfig.orig</filename>, and you could later copy +<filename>sysconfig.orig</filename> to <emphasis +remap=tt>sysconfig</emphasis> to recover the original. But even +better would be moving (renaming) and then copying back: +<informalexample> +<screen># <userinput>mv sysconfig sysconfig.orig</userinput> +# <userinput>cp sysconfig.orig sysconfig</userinput></screen> +</informalexample> + +because the <command>mv</command> command preserves the original date +and owner of the file. You can now edit +<filename>sysconfig</filename>. If you want the original back, you'd +then <userinput>mv sysconfig syconfig.myedit</userinput> +(assuming you want to preserve your edited version) and then +<informalexample> +<screen># <userinput>mv sysconfig.orig sysconfig</userinput></screen> +</informalexample> +to put things back the way they were.</para> + +<para>To edit a file, type +<informalexample> +<screen># <userinput>vi <replaceable>filename</replaceable></userinput></screen> +</informalexample> +Move through the text with the arrow keys. <keycap>Esc</keycap> (the +escape key) puts <command>vi</command> in command mode. Here are some +commands: +<variablelist> +<varlistentry><term><command>x</command></term> +<listitem> +<para>delete letter the cursor is on</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>dd</command></term> + +<listitem> +<para>delete the entire line (even if it wraps on the screen)</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>i</command></term> + +<listitem> +<para>insert text at the cursor</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>a</command></term> + +<listitem> +<para>insert text after the cursor</para> + +</listitem> +</varlistentry> +</variablelist> +Once you type <command>i</command> or <command>a</command>, you can enter text. +<command>Esc</command> puts you back in command mode where you can type +<variablelist> +<varlistentry><term><command>:w</command></term> +<listitem> +<para>to write your changes to disk and continue editing</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>:wq</command></term> + +<listitem> +<para>to write and quit</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>:q!</command></term> + +<listitem> +<para>to quit without saving changes</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>/<replaceable>text</replaceable></command></term> + +<listitem> +<para>to move the cursor to <replaceable>text</replaceable>; +<command>/<keycap>Enter</keycap></command> (the enter key) to find +the next instance of <replaceable>text</replaceable>.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>G</command></term> + +<listitem> +<para>to go to the end of the file</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command><replaceable>n</replaceable>G</command></term> + +<listitem> +<para>to go to line <replaceable>n</replaceable> in +the file, where <replaceable>n</replaceable> is a number</para> + +</listitem> +</varlistentry> + +<varlistentry><term><keycombo><keycap>Ctrl</><keycap>L</></keycombo></term> + +<listitem> +<para>to redraw the screen</para> + +</listitem> +</varlistentry> + +<varlistentry><term><keycombo><keycap>Ctrl</><keycap>b</></> and <keycombo><keycap>Ctrl</><keycap>f</></></term> + +<listitem> +<para>go back +and forward a screen, as they +do with <command>more</> and <command>view</>.</para> + +</listitem> +</varlistentry> +</variablelist> +</para> + +<para>Practice with <command>vi</> in your home directory by creating +a new file with <command>vi <replaceable>filename</></> and adding +and deleting text, saving the file, and calling it up again. +<command>vi</> delivers some surprises because it's really quite +complex, and sometimes you'll inadvertently issue a command that will +do something you don't expect. (Some people actually like +<command>vi</>—it's more powerful than DOS EDIT—find out +about the <command>:r</> command.) Use <keycap>Esc</> one or +more times to be sure you're in command mode and proceed from there +when it gives you trouble, save often with <command>:w</>, and +use <command>:q!</> to get out and start over (from +your last <command>:w</>) when you need to.</para> + +<para>Now you can <command>cd</> to <filename>/etc</filename>, +<command>su</> to root, use <command>vi</> to edit the file +<filename>/etc/group</filename>, and add a user to wheel so the user +has root privileges. Just add a comma and the user's login name to +the end of the first line in the file, press <keycap>Esc</>, and use +<command>:wq</> to write the file to disk and quit. Instantly +effective. (You didn't put a space after the comma, did you?)</para> + +</chapter> + +<chapter> +<title>Printing Files from DOS</title> + +<para>At this point you probably don't have the printer working, so here's a +way to create a file from a man 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 the command +man chmod to read about it. The command +<informalexample> +<screen># <userinput>man chmod > chmod.txt</></screen> +</informalexample> +will send the man page to the <filename>chmod.txt</filename> file +instead of showing it on your screen. Now put a dos-formatted +diskette in your floppy drive a, <command>su</> to +root, and type +<informalexample> +<screen># <userinput>/sbin/mount -t msdos /dev/fd0 /mnt</></screen> +</informalexample> +to mount the floppy drive on <filename>/mnt</filename>.</para> + +<para>Now (you no longer need to be root, and you can type +<command>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: +<informalexample> +<screen>% <userinput>cp chmod.txt /mnt</></screen> +</informalexample> +and use <command>ls /mnt</command> to get a directory listing of +<filename>/mnt</filename>, which should show the file +<filename>chmod.txt</filename>.</para> + +<para>You might especially want to make a file from +<filename>/sbin/dmesg</filename> by typing +<informalexample> +<screen>% <userinput>/sbin/dmesg > dmesg.txt</></screen> +</informalexample> +and copying <filename>dmesg.txt</filename> to the floppy. +<command>/sbin/dmesg</command> is the boot log record, and it's +useful to understand it because it shows what FreeBSD found when it +booted up. If you ask questions on +<email>freebsd-questions@FreeBSD.ORG</> or on a USENET +group—like <quote>FreeBSD isn't finding my tape drive, what do +I do?</quote>—people will want to know what <command>dmesg</> +has to say.</para> + +<para>You can now dismount the floppy drive (as root) to get the disk +out with +<informalexample> +<screen># <userinput>/sbin/umount /mnt</></screen> +</informalexample> +and reboot to go to DOS. Copy these files to a DOS directory, call +them up with DOS EDIT, Windows Notepad, 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! man pages come out best if +printed with the dos <command>print</> command. (Copying files from +FreeBSD to a mounted dos partition is in some cases still a little +risky.)</para> + +<para>Getting the printer printing from FreeBSD involves creating an +appropriate entry in <filename>/etc/printcap</filename> and creating +a matching spool directory in +<filename>/var/spool/output</filename>. If your printer is on +<hardware>lpt0</> (what dos calls <hardware>LPT1</>), you may only +need to go to <filename>/var/spool/output</filename> and (as root) +create the directory <filename>lpd</> by typing: +<informalexample> +<screen># <userinput>mkdir lpd</></screen> +</informalexample> +Then the printer should respond if it's 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 <ulink +URL="http://www.freebsd.org/handbook/handbook.html">FreeBSD +handbook.</></para> + +</chapter> + +<chapter> +<title>Other Useful Commands</title> + +<para> +<variablelist> +<varlistentry><term><command>df</></term> +<listitem> +<para>shows file space and mounted systems.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ps aux</></term> + +<listitem> +<para>shows processes running. <command>ps ax</> is a narrower form.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>rm <replaceable>filename</></></term> + +<listitem> +<para>remove <replaceable>filename</>.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>rm -R <replaceable>dir</></></term> + +<listitem> +<para>removes a directory <replaceable>dir</> and all +subdirectories—careful!</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls -R</command></term> + +<listitem> +<para>lists files in the current +directory and all subdirectories; +I used a variant, <command>ls -AFR > where.txt</command>, +to get a list of all +the files in <filename>/</filename> and (separately) +<filename>/usr</filename> before I found better +ways to find files.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>passwd</></term> + +<listitem> +<para>to change user's password (or root's password)</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>man hier</></term> + +<listitem> +<para>man page on the Unix file system</para> + +</listitem> +</varlistentry> +</variablelist></para> + +<para>Use <command>find</> to locate filename in <filename>/usr</filename> +or any of its subdirectories with +<informalexample> +<screen>% <userinput>find /usr -name "<replaceable>filename</>"</></screen> +</informalexample> +You can use <literal>*</literal> as a wildcard in +<parameter>"<replaceable>filename</>"</> (which should be in +quotes). If you tell find to search in <filename>/</filename> +instead of <filename>/usr</filename> it will look for the file(s) on +all mounted file systems, including the CDROM and the dos +partition.</para> + +<para>An excellent book that explains Unix commands and utilities is +Abrahams & Larson, <citetitle>Unix for the Impatient</citetitle> +(2nd ed., Addison-Wesley, 1996). There's also a lot of Unix +information on the Internet. Try the <ulink +URL="http://www.eecs.nwu.edu/unix.html">Unix Reference +Desk</ulink>.</para> + +</chapter> + +<chapter> +<title>Next Steps</title> + +<para>You should now have the tools you need to get around and edit +files, so you can get everything up and running. There is a great +deal of information in the FreeBSD handbook (which is probably on +your hard drive) and <ulink URL="http://www.freebsd.org/">FreeBSD's +web site</ulink>. A wide variety of packages and ports are on the +<ulink URL="http://www.cdrom.com/">Walnut Creek</ulink> CDROM as well +as the web site. The handbook tells you more about how to use them +(get the package if it exists, with <command>pkg_add +/cdrom/packages/All/<replaceable>packagename</></>, +where <replaceable>packagename</replaceable> is the filename of the +package). The cdrom has lists of the packages and ports with brief +descriptions in <filename>cdrom/packages/index</filename>, +<filename>cdrom/packages/index.txt</filename>, and +<filename>cdrom/ports/index</filename>, with fuller descriptions in +<filename>/cdrom/ports/*/*/pkg/DESCR</filename>, where the +<literal>*</literal>s represent subdirectories of kinds of programs +and program names respectively.</para> + +<para>If you find the handbook too sophisticated (what with +<command>lndir</> and all) on installing ports from the cdrom, +here's what usually works:</para> + +<para>Find the port you want, say <command>kermit</>. There will be +a directory for it on the cdrom. Copy the subdirectory to +<filename>/usr/local</filename> (a good place for software you add +that should be available to all users) with: +<informalexample> +<screen># <userinput>cp -R /cdrom/ports/comm/kermit /usr/local</></screen> +</informalexample> + +This should result in a <filename>/usr/local/kermit</filename> +subdirectory that has all the files that the +<command>kermit</command> subdirectory on the CDROM has.</para> + +<para>Next, check <filename>/cdrom/ports/distfiles</filename> for a +file with a name that indicates it's the port you want. Copy that +file to <filename>/usr/ports/distfiles</filename>. (Create +<filename>/usr/ports/distfiles</filename> if it doesn't exist using +<command>mkdir</>.) In the case of <command>kermit</>, there is no +distfile.</para> + +<para>Then <command>cd</> to the subdirectory of +<filename>/usr/local/kermit</filename> that has the file +<filename>Makefile</>. Type +<informalexample> +<screen># <userinput>make all install</></screen> +</informalexample> +</para> + +<para>During this process the port will ftp to get any compressed +files it needs that it didn't find in +<filename>/usr/ports/distfiles</filename>. If you don't have your +network running yet and there was no file for the port in +<filename>/cdrom/ports/distfiles</filename>, you will have to get +the distfile using another machine and copy it to +<filename>/usr/ports/distfiles</filename> from a floppy or your dos +partition. Read <filename>Makefile</> (with <command>cat</> or +<command>more</> or <command>view</>) to find out where to go (the +master distribution site) to get the file and what its name is. Its +name will be truncated when downloaded to DOS, and after you get it +into <filename>/usr/ports/distfiles</filename> you'll have to rename +it (with the <command>mv</> command) to its original name so it can +be found. (Use binary file transfers!) Then go back to +<filename>/usr/local/kermit</filename>, find the directory with +<filename>Makefile</>, and type <command>make all install</>.</para> + +<para>The other thing that happens when installing ports or packages +is that some other program is needed. If the installation stops with +a message <errorname>can't find unzip</errorname> or whatever, you +might need to install the package or port for unzip before you +continue.</para> + +<para>Once it's installed type <command>rehash</> to make FreeBSD +reread the files in the path so it knows what's there. (If you get a +lot of <errorname>path not found</> messages when you use +<command>whereis</> or which, you might want to make additions to the +list of directories in the path statement in +<filename>.cshrc</filename> in your home directory. The path +statement in Unix does the same kind of work it does in DOS, except +the current directory is not (by default) in the path for security +reasons; if the command you want is in the directory you're in, you +need to type <filename>./</filename> before the command to make it +work; no space after the slash.)</para> + +<para>You might want to get the most recent version of Netscape from +their <ulink URL="ftp://ftp.netscape.com">ftp site</ulink>. (Netscape +requires the X Window System.) The version you want is the +<quote>unknown bsd</quote> version. Just use <command>gunzip +<replaceable>filename</></> and <command>tar xvf +<replaceable>filename</></> on it, move the binary to +<filename>/usr/local/bin</filename> or some other place binaries are +kept, <command>rehash</>, and then put the following lines in +<filename>.cshrc</filename> in each user's home directory or (easier) +in <filename>/etc/csh.cshrc</filename>, the system-wide csh start-up +file: +<informalexample> +<programlisting>setenv XKEYSYMDB /usr/X11R6/lib/X11/XKeysymDB +setenv XNLSPATH /usr/X11R6/lib/X11/nls</> +</informalexample> +This assumes that the file <filename>XKeysymDB</> and the directory +<filename>nls</> are in <filename>/usr/X11R6/lib/X11</filename>; if +they're not, find them and put them there.</para> + +<para>If you originally got Netscape as a port using the CDROM (or +ftp), don't replace <filename>/usr/local/bin/netscape</filename> with +the new netscape binary; this is just a shell script that sets up the +environmental variables for you. Instead rename the new binary to +<filename>netscape.bin</filename> and replace the old binary, which +is <filename>/usr/local/lib/netscape/netscape.bin</filename>.</para> + +</chapter> + +<chapter> +<title>Other</title> + +<para>As root, you can dismount the CDROM with <command>/sbin/umount +/cdrom</>, take it out of the drive, insert another one, and mount it +with <command>/sbin/mount_cd9660 /dev/cd0a /cdrom</> assuming +<hardware>cd0a</> is the device name for your CDROM drive.</para> + +<para>Using the live file system—the second of FreeBSD's CDROM +disks—is useful if you've got limited space. You might try +using <command>emacs</> or playing games from the cdrom. This +involves using <command>lndir</>, which gets installed with the X +Window System, to tell the program(s) where to find the necessary +files, because they're in the <filename>/cdrom</filename> file system +instead of in <filename>/usr</filename> and its subdirectories, which +is where they're expected to be. Read <command>man lndir</>.</para> + +<para>You can delete a user (say, jack) by using the command +<command>vipw</> to bring up the <filename>master.passwd</filename> +file (do not use <command>vi</> directly on master.passwd); delete +the line for jack and save the file. Then edit +<filename>/etc/group</filename>, eliminating jack wherever it +appears. Finally, go to <filename>/usr/home</filename> and use +<command>rm -R</command> jack (to get rid of user jack's home +directory files).</para> + +</chapter> + +<chapter> +<title>Comments Welcome</title> + +<para>If you use this guide I'd be interested in knowing where it was +unclear and what was left out that you think should be included, and +if it was helpful. My thanks to Eugene W. Stark, professor of +computer science at SUNY-Stony Brook, and John Fieber for helpful +comments.</para> + +<para>Annelise Anderson, <email>andrsn@hoover.stanford.edu</></para> + +</chapter> +</book> diff --git a/en_US.ISO_8859-1/articles/new-users/Makefile b/en_US.ISO_8859-1/articles/new-users/Makefile index d8d8509284..a0f6762443 100644 --- a/en_US.ISO_8859-1/articles/new-users/Makefile +++ b/en_US.ISO_8859-1/articles/new-users/Makefile @@ -1,5 +1,5 @@ -DOC= newuser -SRCS= newuser.sgml +DOCS= newuser.docb +INDEXLINK= newuser.html -.include <bsd.sgml.mk> +.include "../../web.mk" diff --git a/en_US.ISO_8859-1/articles/new-users/article.sgml b/en_US.ISO_8859-1/articles/new-users/article.sgml new file mode 100644 index 0000000000..c98403616b --- /dev/null +++ b/en_US.ISO_8859-1/articles/new-users/article.sgml @@ -0,0 +1,844 @@ +<!DOCTYPE BOOK PUBLIC "-//Davenport//DTD DocBook V3.0//EN"> +<book> + +<bookinfo> +<bookbiblio> +<title>For People New to Both FreeBSD and Unix</title> + +<authorgroup> +<author> +<firstname>Annelise</firstname> +<surname>Anderson</surname> +<affiliation> +<address><email>andrsn@hoover.stanford.edu</email></address> +</affiliation> +</author> +</authorgroup> + +<pubdate>June 30, 1996</pubdate> + +<abstract><para>Congratulations on installing FreeBSD! This +introduction is for people new to both FreeBSD +<emphasis>and</emphasis> Un*x—so it starts with basics. It +assumes you're using version 2.0.5 or later of FreeBSD as distributed +by Walnut Creek or FreeBSD.ORG, your system (for now) has a single +user (you)—and you're probably pretty good with DOS/Windows or +OS/2.</para></abstract> + +</bookbiblio> +</bookinfo> + +<chapter> +<title>Logging in and Getting Out</title> + +<para>Log in (when you see <systemitem +class=prompt>login:</systemitem>) as a user you created during +installation or as <firstterm>root</firstterm>. (Your FreeBSD +installation will already have an account for root; root can go +anywhere and do anything, including deleting essential files, so be +careful!)</para> + +<para>To log out (and get a new <systemitem class=prompt>login:</systemitem> prompt) type +<informalexample> +<screen># <userinput>exit</userinput></screen> +</informalexample> +as often as necessary. Yes, press <keysym>enter</keysym> after +commands, and remember that Unix is +case-sensitive—<command>exit</command>, not +<command>EXIT</command>.</para> + +<para>To shut down the machine type: +<informalexample> +<screen># <userinput>/sbin/shutdown -h now</userinput></screen> +</informalexample> +Or to reboot type +<informalexample> +<screen># <userinput>/sbin/shutdown -r now</userinput></screen> +</informalexample> +or +<informalexample> +<screen># <userinput>/sbin/reboot</userinput></screen> +</informalexample> +</para> + +<para>You can also reboot with +<keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>Delete</keycap></keycombo>. +Give it a little time to do its work. This is equivalent to +<command>/sbin/reboot</command> in recent releases of FreeBSD, and is +much, much better than hitting the reset button. You don't want to +have to reinstall this thing, do you?</para> + +</chapter> + +<chapter> +<title>Adding A User with Root Privileges</title> + +<para>If you didn't create any users when you installed the system and +are thus logged in as root, you should probably create a user now with +<informalexample> +<screen># <userinput>adduser</userinput></screen> +</informalexample> +Don't use the <option>-verbose</option> option; the defaults are what +you want. Suppose you create a user <emphasis>jack</emphasis> with +full name <emphasis>Jack Benimble</emphasis>. Give jack a password +if security (even kids around who might pound on the keyboard) is an +issue. When it asks you if you want to invite jack into other +groups, type <userinput>wheel</userinput> +<informalexample> +<screen>Login group is ``jack''. Invite jack into other groups: <userinput>wheel</userinput></screen> +</informalexample> +This will make it possible to log in as <emphasis>jack</emphasis> and +use the <command>su</command> command to become root. Then you won't +get scolded any more for logging in as root, and as root you'll have +the same environment as jack (this is good).</para> + +<para>You can quit <command>adduser</command> any time by typing +<keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo>, and at +the end you'll have a chance to approve your new user or simply type +<keycap>n</keycap> for no. You might want to create a +second new user (jill?) so that when you edit jack's login files, +you'll have a hot spare in case something goes wrong.</para> + +<para>Once you've done this, use <command>exit</command> +to get back to a login prompt and log in as +<emphasis>jack</emphasis>. In general, it's a good idea to do as +much work as possible as an ordinary user who doesn't have the +power—and risk—of root.</para> + +<para>If you already created a user and you want the user to be able +to <command>su</command> to root, you can log in as root +and edit the file <filename>/etc/group</filename>, adding jack to the +first line (the group wheel). But first you need to practice +<command>vi</command>, the text editor.</para> + +</chapter> + +<chapter> +<title>Looking Around</title> + +<para>Logged in as an ordinary user, look around and try out some +commands that will access the sources of help and information within +FreeBSD.</para> + +<para>Here are some commands and what they do: +<variablelist> +<varlistentry><term><command>id</command></term> +<listitem> +<para>Tells you who you are!</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>pwd</command></term> + +<listitem> +<para>Shows you where you are—the current +working directory.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls</command></term> + +<listitem> +<para>Lists the files in the current directory.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls <option>-F</option></command></term> + +<listitem> +<para>Lists the files in the current directory with a +<literal>*</literal> after executables, a <literal>/</literal> after +directories, and an <literal>@</literal> after symbolic links.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls <option>-l</option></command></term> + +<listitem> +<para>Lists the files in long format—size, +date, permissions.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls <option>-a</option></command></term> + +<listitem> +<para>Lists hidden (unless you're root) <quote>dot</quote> +files with the others.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>cd</command></term> + +<listitem> +<para>Changes directories. <command>cd +<parameter>..</parameter></command> backs up one level; note the +space after <command>cd</command>. <command>cd +<parameter>/usr/local</parameter></command> goes there. <command>cd +<parameter>~</parameter></command> goes to the home directory of the +person logged in—e.g., <filename>/usr/home/jack</filename>. +Try <command>cd <parameter>/cdrom</parameter></command>, and then +<command>ls</command>, to find out if your CDROM is mounted and +working.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>view <replaceable>filename</replaceable></command></term> + +<listitem> +<para>Lets you look at a file (named +<replaceable>filename</replaceable> without changing it. Try +<command>view <parameter>/etc/fstab</parameter></command>. +<command>:q</command> to quit.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>cat <replaceable>filename</replaceable></command></term> + +<listitem> + +<para>Displays <replaceable>filename</replaceable> on screen. If +it's too long and you can see only the end of it, press +<keycap>ScrollLock</keycap> and use the <keycap>up-arrow</keycap> to +move backward; you can use <keycap>ScrollLock</keycap> with man pages +too. Press <keycap>ScrollLock</keycap> again to quit scrolling. You +might want to try <command>cat</command> on some of the dot files in +your home directory—<command>cat +<parameter>.cshrc</parameter></command>, <command>cat +<parameter>.login</parameter></command>, <command>cat +<parameter>.profile</parameter></command>.</para> + +</listitem> +</varlistentry> +</variablelist> + +You'll notice aliases in <filename>.cshrc</filename> for some of the +<command>ls</command> commands (they're very convenient). +You can create other aliases by editing <filename>.cshrc</filename>. +You can make these aliases available to all users on the system by +putting them in the system-wide csh configuration file, +<filename>/etc/csh.cshrc</filename>.</para> + +</chapter> + +<chapter> +<title>Getting Help and Information</title> + +<para>Here are some useful sources of help. +<replaceable>Text</replaceable> stands for something of your choice +that you type in—usually a command or filename.</para> + +<variablelist> +<varlistentry><term><command>apropos <replaceable>text</replaceable></command></term> + +<listitem> +<para>Everything containing string <replaceable>text</replaceable> +in the <database>whatis database</database>.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>man <replaceable>text</replaceable></command></term> + +<listitem> +<para>The man page for <replaceable>text</replaceable>. The major +source of documentation for Un*x systems. <command>man +<parameter>ls</parameter></command> will tell you all the ways to use +the <command>ls</command> command. Press <keycap>Enter</keycap> to +move through text, +<keycombo><keycap>Ctrl</keycap><keycap>b</keycap></keycombo> to go +back a page, <keycombo><keycap>Ctrl</keycap><keycap>f</keycap></keycombo> to +go forward, <keycap>q</keycap> or +<keycombo><keycap>Ctrl</keycap><keycap>c</keycap></keycombo> to +quit.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>which <replaceable>text</replaceable></command></term> + +<listitem> +<para>Tells you where in the user's path the command +<replaceable>text</replaceable> is found.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>locate <replaceable>text</replaceable></command></term> + +<listitem> +<para>All the paths where the string <replaceable>text</replaceable> +is found.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>whatis <replaceable>text</replaceable></command></term> + +<listitem> +<para>Tells you what the command <replaceable>text</replaceable> +does and its man page.</para> +</listitem> +</varlistentry> + +<varlistentry><term><command>whereis <replaceable>text</replaceable></command></term> + +<listitem> +<para>Finds the file <replaceable>text</replaceable>, giving its full +path.</para> +</listitem> +</varlistentry> +</variablelist> + +<para>You might want to try using <command>whatis</command> on some +common useful commands like <command>cat</command>, +<command>more</command>, <command>grep</command>, +<command>mv</command>, <command>find</command>, +<command>tar</command>, <command>chmod</command>, +<command>chown</command>, <command>date</command>, and +<command>script</command>. <command>more</command> lets you read a +page at a time as it does in DOS, e.g., <command>ls -l | +more</command> or <command>more +<replaceable>filename</replaceable></command>. The +<literal>*</literal> works as a wildcard—e.g., <command>ls +w*</command> will show you files beginning with +<literal>w</literal>.</para> + +<para>Are some of these not working very well? Both +<command>locate</command> and <command>whatis</command> +depend on a database that's rebuilt weekly. If your machine isn't +going to be left on over the weekend (and running FreeBSD), you might +want to run the commands for daily, weekly, and monthly maintenance +now and then. Run them as root and give each one time to finish +before you start the next one, for now. +<informalexample> +<screen># <userinput>/etc/daily</userinput> +<lineannotation>output omitted</lineannotation> +# <userinput>/etc/weekly</userinput> +<lineannotation>output omitted</lineannotation> +# <userinput>/etc/monthly</userinput> +<lineannotation>output omitted</lineannotation></screen> +</informalexample></para> + +<para>If you get tired waiting, press +<keycombo><keycap>Alt</keycap><keycap>F2</keycap></keycombo> to get +another <firstterm>virtual console</firstterm>, and log in again. +After all, it's a multi-user, multi-tasking system. Nevertheless +these commands will probably flash messages on your screen while +they're running; you can type <command>clear</command> at the prompt +to clear the screen. Once they've run, you might want to look at +<filename>/var/mail/root</filename> and +<filename>/var/log/messages</filename>.</para> + +<para>Basically running such commands is part of system +administration—and as a single user of a Unix system, you're +your own system administrator. Virtually everything you need to be +root to do is system administration. Such responsibilities aren't +covered very well even in those big fat books on Unix, which seem to +devote a lot of space to pulling down menus in windows managers. You +might want to get one of the two leading books on systems +administration, either Evi Nemeth et.al.'s <citetitle>UNIX System +Administration Handbook</citetitle> (Prentice-Hall, 1995, ISBN +0-13-15051-7)—the second edition with the red cover; or +Æleen Frisch's <citetitle>Essential System +Administration</citetitle> (O'Reilly & Associates, 1993, ISBN +0-937175-80-3). I used Nemeth.</para> + +</chapter> + +<chapter> +<title>Editing Text</title> + +<para>To configure your system, you need to edit text files. Most of +them will be in the <filename>/etc</filename> directory; and you'll +need to <command>su</command> to root to be able to change them. The +text editor is <command>vi</command>. Before you edit a file, you +should probably back it up. Suppose you want to edit +<filename>/etc/sysconfig</filename>. You could just use <command>cd +/etc</command> to get to the <filename>/etc</filename> directory and +do: +<informalexample> +<screen># <userinput>cp sysconfig sysconfig.orig</userinput></screen> +</informalexample> + +This would copy <filename>sysconfig</filename> to +<filename>sysconfig.orig</filename>, and you could later copy +<filename>sysconfig.orig</filename> to <emphasis +remap=tt>sysconfig</emphasis> to recover the original. But even +better would be moving (renaming) and then copying back: +<informalexample> +<screen># <userinput>mv sysconfig sysconfig.orig</userinput> +# <userinput>cp sysconfig.orig sysconfig</userinput></screen> +</informalexample> + +because the <command>mv</command> command preserves the original date +and owner of the file. You can now edit +<filename>sysconfig</filename>. If you want the original back, you'd +then <userinput>mv sysconfig syconfig.myedit</userinput> +(assuming you want to preserve your edited version) and then +<informalexample> +<screen># <userinput>mv sysconfig.orig sysconfig</userinput></screen> +</informalexample> +to put things back the way they were.</para> + +<para>To edit a file, type +<informalexample> +<screen># <userinput>vi <replaceable>filename</replaceable></userinput></screen> +</informalexample> +Move through the text with the arrow keys. <keycap>Esc</keycap> (the +escape key) puts <command>vi</command> in command mode. Here are some +commands: +<variablelist> +<varlistentry><term><command>x</command></term> +<listitem> +<para>delete letter the cursor is on</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>dd</command></term> + +<listitem> +<para>delete the entire line (even if it wraps on the screen)</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>i</command></term> + +<listitem> +<para>insert text at the cursor</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>a</command></term> + +<listitem> +<para>insert text after the cursor</para> + +</listitem> +</varlistentry> +</variablelist> +Once you type <command>i</command> or <command>a</command>, you can enter text. +<command>Esc</command> puts you back in command mode where you can type +<variablelist> +<varlistentry><term><command>:w</command></term> +<listitem> +<para>to write your changes to disk and continue editing</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>:wq</command></term> + +<listitem> +<para>to write and quit</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>:q!</command></term> + +<listitem> +<para>to quit without saving changes</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>/<replaceable>text</replaceable></command></term> + +<listitem> +<para>to move the cursor to <replaceable>text</replaceable>; +<command>/<keycap>Enter</keycap></command> (the enter key) to find +the next instance of <replaceable>text</replaceable>.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>G</command></term> + +<listitem> +<para>to go to the end of the file</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command><replaceable>n</replaceable>G</command></term> + +<listitem> +<para>to go to line <replaceable>n</replaceable> in +the file, where <replaceable>n</replaceable> is a number</para> + +</listitem> +</varlistentry> + +<varlistentry><term><keycombo><keycap>Ctrl</><keycap>L</></keycombo></term> + +<listitem> +<para>to redraw the screen</para> + +</listitem> +</varlistentry> + +<varlistentry><term><keycombo><keycap>Ctrl</><keycap>b</></> and <keycombo><keycap>Ctrl</><keycap>f</></></term> + +<listitem> +<para>go back +and forward a screen, as they +do with <command>more</> and <command>view</>.</para> + +</listitem> +</varlistentry> +</variablelist> +</para> + +<para>Practice with <command>vi</> in your home directory by creating +a new file with <command>vi <replaceable>filename</></> and adding +and deleting text, saving the file, and calling it up again. +<command>vi</> delivers some surprises because it's really quite +complex, and sometimes you'll inadvertently issue a command that will +do something you don't expect. (Some people actually like +<command>vi</>—it's more powerful than DOS EDIT—find out +about the <command>:r</> command.) Use <keycap>Esc</> one or +more times to be sure you're in command mode and proceed from there +when it gives you trouble, save often with <command>:w</>, and +use <command>:q!</> to get out and start over (from +your last <command>:w</>) when you need to.</para> + +<para>Now you can <command>cd</> to <filename>/etc</filename>, +<command>su</> to root, use <command>vi</> to edit the file +<filename>/etc/group</filename>, and add a user to wheel so the user +has root privileges. Just add a comma and the user's login name to +the end of the first line in the file, press <keycap>Esc</>, and use +<command>:wq</> to write the file to disk and quit. Instantly +effective. (You didn't put a space after the comma, did you?)</para> + +</chapter> + +<chapter> +<title>Printing Files from DOS</title> + +<para>At this point you probably don't have the printer working, so here's a +way to create a file from a man 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 the command +man chmod to read about it. The command +<informalexample> +<screen># <userinput>man chmod > chmod.txt</></screen> +</informalexample> +will send the man page to the <filename>chmod.txt</filename> file +instead of showing it on your screen. Now put a dos-formatted +diskette in your floppy drive a, <command>su</> to +root, and type +<informalexample> +<screen># <userinput>/sbin/mount -t msdos /dev/fd0 /mnt</></screen> +</informalexample> +to mount the floppy drive on <filename>/mnt</filename>.</para> + +<para>Now (you no longer need to be root, and you can type +<command>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: +<informalexample> +<screen>% <userinput>cp chmod.txt /mnt</></screen> +</informalexample> +and use <command>ls /mnt</command> to get a directory listing of +<filename>/mnt</filename>, which should show the file +<filename>chmod.txt</filename>.</para> + +<para>You might especially want to make a file from +<filename>/sbin/dmesg</filename> by typing +<informalexample> +<screen>% <userinput>/sbin/dmesg > dmesg.txt</></screen> +</informalexample> +and copying <filename>dmesg.txt</filename> to the floppy. +<command>/sbin/dmesg</command> is the boot log record, and it's +useful to understand it because it shows what FreeBSD found when it +booted up. If you ask questions on +<email>freebsd-questions@FreeBSD.ORG</> or on a USENET +group—like <quote>FreeBSD isn't finding my tape drive, what do +I do?</quote>—people will want to know what <command>dmesg</> +has to say.</para> + +<para>You can now dismount the floppy drive (as root) to get the disk +out with +<informalexample> +<screen># <userinput>/sbin/umount /mnt</></screen> +</informalexample> +and reboot to go to DOS. Copy these files to a DOS directory, call +them up with DOS EDIT, Windows Notepad, 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! man pages come out best if +printed with the dos <command>print</> command. (Copying files from +FreeBSD to a mounted dos partition is in some cases still a little +risky.)</para> + +<para>Getting the printer printing from FreeBSD involves creating an +appropriate entry in <filename>/etc/printcap</filename> and creating +a matching spool directory in +<filename>/var/spool/output</filename>. If your printer is on +<hardware>lpt0</> (what dos calls <hardware>LPT1</>), you may only +need to go to <filename>/var/spool/output</filename> and (as root) +create the directory <filename>lpd</> by typing: +<informalexample> +<screen># <userinput>mkdir lpd</></screen> +</informalexample> +Then the printer should respond if it's 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 <ulink +URL="http://www.freebsd.org/handbook/handbook.html">FreeBSD +handbook.</></para> + +</chapter> + +<chapter> +<title>Other Useful Commands</title> + +<para> +<variablelist> +<varlistentry><term><command>df</></term> +<listitem> +<para>shows file space and mounted systems.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ps aux</></term> + +<listitem> +<para>shows processes running. <command>ps ax</> is a narrower form.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>rm <replaceable>filename</></></term> + +<listitem> +<para>remove <replaceable>filename</>.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>rm -R <replaceable>dir</></></term> + +<listitem> +<para>removes a directory <replaceable>dir</> and all +subdirectories—careful!</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>ls -R</command></term> + +<listitem> +<para>lists files in the current +directory and all subdirectories; +I used a variant, <command>ls -AFR > where.txt</command>, +to get a list of all +the files in <filename>/</filename> and (separately) +<filename>/usr</filename> before I found better +ways to find files.</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>passwd</></term> + +<listitem> +<para>to change user's password (or root's password)</para> + +</listitem> +</varlistentry> + +<varlistentry><term><command>man hier</></term> + +<listitem> +<para>man page on the Unix file system</para> + +</listitem> +</varlistentry> +</variablelist></para> + +<para>Use <command>find</> to locate filename in <filename>/usr</filename> +or any of its subdirectories with +<informalexample> +<screen>% <userinput>find /usr -name "<replaceable>filename</>"</></screen> +</informalexample> +You can use <literal>*</literal> as a wildcard in +<parameter>"<replaceable>filename</>"</> (which should be in +quotes). If you tell find to search in <filename>/</filename> +instead of <filename>/usr</filename> it will look for the file(s) on +all mounted file systems, including the CDROM and the dos +partition.</para> + +<para>An excellent book that explains Unix commands and utilities is +Abrahams & Larson, <citetitle>Unix for the Impatient</citetitle> +(2nd ed., Addison-Wesley, 1996). There's also a lot of Unix +information on the Internet. Try the <ulink +URL="http://www.eecs.nwu.edu/unix.html">Unix Reference +Desk</ulink>.</para> + +</chapter> + +<chapter> +<title>Next Steps</title> + +<para>You should now have the tools you need to get around and edit +files, so you can get everything up and running. There is a great +deal of information in the FreeBSD handbook (which is probably on +your hard drive) and <ulink URL="http://www.freebsd.org/">FreeBSD's +web site</ulink>. A wide variety of packages and ports are on the +<ulink URL="http://www.cdrom.com/">Walnut Creek</ulink> CDROM as well +as the web site. The handbook tells you more about how to use them +(get the package if it exists, with <command>pkg_add +/cdrom/packages/All/<replaceable>packagename</></>, +where <replaceable>packagename</replaceable> is the filename of the +package). The cdrom has lists of the packages and ports with brief +descriptions in <filename>cdrom/packages/index</filename>, +<filename>cdrom/packages/index.txt</filename>, and +<filename>cdrom/ports/index</filename>, with fuller descriptions in +<filename>/cdrom/ports/*/*/pkg/DESCR</filename>, where the +<literal>*</literal>s represent subdirectories of kinds of programs +and program names respectively.</para> + +<para>If you find the handbook too sophisticated (what with +<command>lndir</> and all) on installing ports from the cdrom, +here's what usually works:</para> + +<para>Find the port you want, say <command>kermit</>. There will be +a directory for it on the cdrom. Copy the subdirectory to +<filename>/usr/local</filename> (a good place for software you add +that should be available to all users) with: +<informalexample> +<screen># <userinput>cp -R /cdrom/ports/comm/kermit /usr/local</></screen> +</informalexample> + +This should result in a <filename>/usr/local/kermit</filename> +subdirectory that has all the files that the +<command>kermit</command> subdirectory on the CDROM has.</para> + +<para>Next, check <filename>/cdrom/ports/distfiles</filename> for a +file with a name that indicates it's the port you want. Copy that +file to <filename>/usr/ports/distfiles</filename>. (Create +<filename>/usr/ports/distfiles</filename> if it doesn't exist using +<command>mkdir</>.) In the case of <command>kermit</>, there is no +distfile.</para> + +<para>Then <command>cd</> to the subdirectory of +<filename>/usr/local/kermit</filename> that has the file +<filename>Makefile</>. Type +<informalexample> +<screen># <userinput>make all install</></screen> +</informalexample> +</para> + +<para>During this process the port will ftp to get any compressed +files it needs that it didn't find in +<filename>/usr/ports/distfiles</filename>. If you don't have your +network running yet and there was no file for the port in +<filename>/cdrom/ports/distfiles</filename>, you will have to get +the distfile using another machine and copy it to +<filename>/usr/ports/distfiles</filename> from a floppy or your dos +partition. Read <filename>Makefile</> (with <command>cat</> or +<command>more</> or <command>view</>) to find out where to go (the +master distribution site) to get the file and what its name is. Its +name will be truncated when downloaded to DOS, and after you get it +into <filename>/usr/ports/distfiles</filename> you'll have to rename +it (with the <command>mv</> command) to its original name so it can +be found. (Use binary file transfers!) Then go back to +<filename>/usr/local/kermit</filename>, find the directory with +<filename>Makefile</>, and type <command>make all install</>.</para> + +<para>The other thing that happens when installing ports or packages +is that some other program is needed. If the installation stops with +a message <errorname>can't find unzip</errorname> or whatever, you +might need to install the package or port for unzip before you +continue.</para> + +<para>Once it's installed type <command>rehash</> to make FreeBSD +reread the files in the path so it knows what's there. (If you get a +lot of <errorname>path not found</> messages when you use +<command>whereis</> or which, you might want to make additions to the +list of directories in the path statement in +<filename>.cshrc</filename> in your home directory. The path +statement in Unix does the same kind of work it does in DOS, except +the current directory is not (by default) in the path for security +reasons; if the command you want is in the directory you're in, you +need to type <filename>./</filename> before the command to make it +work; no space after the slash.)</para> + +<para>You might want to get the most recent version of Netscape from +their <ulink URL="ftp://ftp.netscape.com">ftp site</ulink>. (Netscape +requires the X Window System.) The version you want is the +<quote>unknown bsd</quote> version. Just use <command>gunzip +<replaceable>filename</></> and <command>tar xvf +<replaceable>filename</></> on it, move the binary to +<filename>/usr/local/bin</filename> or some other place binaries are +kept, <command>rehash</>, and then put the following lines in +<filename>.cshrc</filename> in each user's home directory or (easier) +in <filename>/etc/csh.cshrc</filename>, the system-wide csh start-up +file: +<informalexample> +<programlisting>setenv XKEYSYMDB /usr/X11R6/lib/X11/XKeysymDB +setenv XNLSPATH /usr/X11R6/lib/X11/nls</> +</informalexample> +This assumes that the file <filename>XKeysymDB</> and the directory +<filename>nls</> are in <filename>/usr/X11R6/lib/X11</filename>; if +they're not, find them and put them there.</para> + +<para>If you originally got Netscape as a port using the CDROM (or +ftp), don't replace <filename>/usr/local/bin/netscape</filename> with +the new netscape binary; this is just a shell script that sets up the +environmental variables for you. Instead rename the new binary to +<filename>netscape.bin</filename> and replace the old binary, which +is <filename>/usr/local/lib/netscape/netscape.bin</filename>.</para> + +</chapter> + +<chapter> +<title>Other</title> + +<para>As root, you can dismount the CDROM with <command>/sbin/umount +/cdrom</>, take it out of the drive, insert another one, and mount it +with <command>/sbin/mount_cd9660 /dev/cd0a /cdrom</> assuming +<hardware>cd0a</> is the device name for your CDROM drive.</para> + +<para>Using the live file system—the second of FreeBSD's CDROM +disks—is useful if you've got limited space. You might try +using <command>emacs</> or playing games from the cdrom. This +involves using <command>lndir</>, which gets installed with the X +Window System, to tell the program(s) where to find the necessary +files, because they're in the <filename>/cdrom</filename> file system +instead of in <filename>/usr</filename> and its subdirectories, which +is where they're expected to be. Read <command>man lndir</>.</para> + +<para>You can delete a user (say, jack) by using the command +<command>vipw</> to bring up the <filename>master.passwd</filename> +file (do not use <command>vi</> directly on master.passwd); delete +the line for jack and save the file. Then edit +<filename>/etc/group</filename>, eliminating jack wherever it +appears. Finally, go to <filename>/usr/home</filename> and use +<command>rm -R</command> jack (to get rid of user jack's home +directory files).</para> + +</chapter> + +<chapter> +<title>Comments Welcome</title> + +<para>If you use this guide I'd be interested in knowing where it was +unclear and what was left out that you think should be included, and +if it was helpful. My thanks to Eugene W. Stark, professor of +computer science at SUNY-Stony Brook, and John Fieber for helpful +comments.</para> + +<para>Annelise Anderson, <email>andrsn@hoover.stanford.edu</></para> + +</chapter> +</book> diff --git a/en_US.ISO_8859-1/tutorials/Makefile b/en_US.ISO_8859-1/tutorials/Makefile index c32c458f52..40a10bc3f1 100644 --- a/en_US.ISO_8859-1/tutorials/Makefile +++ b/en_US.ISO_8859-1/tutorials/Makefile @@ -1,4 +1,5 @@ DOCS= index.sgml -SUBDIR= disklessx -DOCSUBDIR= ddwg devel fonts mh multios newuser ppp +SUBDIR= disklessx newuser +DOCSUBDIR= ddwg devel fonts mh multios ppp + .include "../web.mk" diff --git a/en_US.ISO_8859-1/tutorials/index.sgml b/en_US.ISO_8859-1/tutorials/index.sgml index 897accc191..ebbc838f65 100644 --- a/en_US.ISO_8859-1/tutorials/index.sgml +++ b/en_US.ISO_8859-1/tutorials/index.sgml @@ -1,6 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN" [ <!ENTITY base CDATA ".."> -<!ENTITY date "$Date: 1997-01-17 15:00:57 $"> +<!ENTITY date "$Date: 1997-01-18 02:24:07 $"> <!ENTITY title "FreeBSD Tutorials"> <!ENTITY % includes SYSTEM "../includes.sgml"> %includes; ]> @@ -13,9 +13,8 @@ <a href="mailto:freebsd-doc@FreeBSD.ORG">freebsd-doc@FreeBSD.org</a>.</p> <ul> - <li><a href="newuser/newuser.html">For People New to Both FreeBSD <em>and</em> Unix</a> - (<a href="newuser/newuser.ps">postscript</a>, - <a href="newuser/newuser-html.tar.gz">gzipd tar file</a>)</li> + <li><a href="newuser/newuser.html">For People New to Both FreeBSD + <em>and</em> Unix</a></li> <li><a href="mh/mh.html">An introduction to the MH mail software</a> (<a href="mh/mh.ps">postscript</a>, <a href="mh/mh-html.tar.gz">gzipd tar file</a>)</li>