forked from pifty/tutes-dump
764 lines
23 KiB
HTML
764 lines
23 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
|
|
<!--Converted with LaTeX2HTML 2K.1beta (1.50)
|
|
original version by: Nikos Drakos, CBLU, University of Leeds
|
|
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
|
|
* with significant contributions from:
|
|
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>4. Some Basic Commands</TITLE>
|
|
<META NAME="description" CONTENT="4. Some Basic Commands">
|
|
<META NAME="keywords" CONTENT="unx">
|
|
<META NAME="resource-type" CONTENT="document">
|
|
<META NAME="distribution" CONTENT="global">
|
|
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
|
<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
|
|
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
|
|
|
|
<LINK REL="STYLESHEET" HREF="unx.css">
|
|
|
|
<LINK REL="next" HREF="node6.html">
|
|
<LINK REL="previous" HREF="node4.html">
|
|
<LINK REL="up" HREF="unx.html">
|
|
<LINK REL="next" HREF="node6.html">
|
|
</HEAD>
|
|
|
|
<BODY >
|
|
<!--Navigation Panel-->
|
|
<A NAME="tex2html191"
|
|
HREF="node6.html">
|
|
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
|
|
SRC="../img/latex2html/next.png"></A>
|
|
<A NAME="tex2html187"
|
|
HREF="unx.html">
|
|
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
|
|
SRC="../img/latex2html/up.png"></A>
|
|
<A NAME="tex2html181"
|
|
HREF="node4.html">
|
|
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
|
|
SRC="../img/latex2html/prev.png"></A>
|
|
<A NAME="tex2html189"
|
|
HREF="node1.html">
|
|
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
|
|
SRC="../img/latex2html/contents.png"></A>
|
|
<A NAME="tex2html1"
|
|
HREF="../"><IMG
|
|
ALIGN="BOTTOM" SRC="../img/latex2html/root.png"
|
|
ALT="root">
|
|
</A>
|
|
|
|
<BR>
|
|
<B> Next:</B> <A NAME="tex2html192"
|
|
HREF="node6.html">5. Learning More</A>
|
|
<B> Up:</B> <A NAME="tex2html188"
|
|
HREF="unx.html">Introduction to Unix &</A>
|
|
<B> Previous:</B> <A NAME="tex2html182"
|
|
HREF="node4.html">3. What is Unix?</A>
|
|
  <B> <A NAME="tex2html190"
|
|
HREF="node1.html">Contents</A></B>
|
|
<BR>
|
|
<BR>
|
|
<!--End of Navigation Panel-->
|
|
<!--Table of Child-Links-->
|
|
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
|
|
|
|
<UL>
|
|
<LI><A NAME="tex2html193"
|
|
HREF="#SECTION00510000000000000000">4.1 The Command Line Shell</A>
|
|
<LI><A NAME="tex2html194"
|
|
HREF="#SECTION00520000000000000000">4.2 Listing Files</A>
|
|
<LI><A NAME="tex2html195"
|
|
HREF="#SECTION00530000000000000000">4.3 Moving Around the File System</A>
|
|
<LI><A NAME="tex2html196"
|
|
HREF="#SECTION00540000000000000000">4.4 The VI Cursor Commands</A>
|
|
<LI><A NAME="tex2html197"
|
|
HREF="#SECTION00550000000000000000">4.5 E-mail</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html198"
|
|
HREF="#SECTION00551000000000000000">4.5.1 mutt</A>
|
|
<LI><A NAME="tex2html199"
|
|
HREF="#SECTION00552000000000000000">4.5.2 Graphical E-mail Readers</A>
|
|
<LI><A NAME="tex2html200"
|
|
HREF="#SECTION00553000000000000000">4.5.3 My Own E-mail</A>
|
|
</UL>
|
|
<BR>
|
|
<LI><A NAME="tex2html201"
|
|
HREF="#SECTION00560000000000000000">4.6 Viewing Files</A>
|
|
<LI><A NAME="tex2html202"
|
|
HREF="#SECTION00570000000000000000">4.7 Surf the Web</A>
|
|
<LI><A NAME="tex2html203"
|
|
HREF="#SECTION00580000000000000000">4.8 Upload & Download</A>
|
|
<UL>
|
|
<LI><A NAME="tex2html204"
|
|
HREF="#SECTION00581000000000000000">4.8.1 FTP</A>
|
|
<LI><A NAME="tex2html205"
|
|
HREF="#SECTION00582000000000000000">4.8.2 scp</A>
|
|
<LI><A NAME="tex2html206"
|
|
HREF="#SECTION00583000000000000000">4.8.3 rcp</A>
|
|
<LI><A NAME="tex2html207"
|
|
HREF="#SECTION00584000000000000000">4.8.4 When FTP Doesn't Work</A>
|
|
</UL>
|
|
<BR>
|
|
<LI><A NAME="tex2html208"
|
|
HREF="#SECTION00590000000000000000">4.9 Editing Files</A>
|
|
</UL>
|
|
<!--End of Table of Child-Links-->
|
|
<HR>
|
|
|
|
<H1><A NAME="SECTION00500000000000000000"></A>
|
|
<A NAME="basics"></A>
|
|
<BR>
|
|
4. Some Basic Commands
|
|
</H1>
|
|
|
|
<P>
|
|
|
|
<H1><A NAME="SECTION00510000000000000000">
|
|
4.1 The Command Line Shell</A>
|
|
</H1>
|
|
|
|
<P>
|
|
When you login to a unix system, you'll be on a command
|
|
line. It'll have a prompt like ``<TT>$</TT>'' or ``<TT>bash-2.04$ </TT>'' or maybe ``<TT>%</TT>''. There are other
|
|
variations.
|
|
|
|
<P>
|
|
The command line is how you communicate with the <EM>shell</EM>. The shell is a program that reads commands from a
|
|
command line & runs other programs. It does some other
|
|
things, but they are mostly details. The main point of a
|
|
shell is to run programs.
|
|
|
|
<P>
|
|
The traditional, original shell on unix is called the Bourne
|
|
shell. If you're wondering why it's called the Bourne
|
|
shell, ask yourself who might have written it.
|
|
|
|
<P>
|
|
The Bourne shell program is named <TT>/bin/sh</TT>, but that
|
|
program on most modern unices is actually a pointer to the
|
|
Korn shell or the Born Again shell. Those two shells are
|
|
more modern than the Bourne shell, but they are backward
|
|
compatible with it.
|
|
|
|
<P>
|
|
There are other shells, including C shell (<TT>/bin/csh</TT>)
|
|
& the restricted shell. You can change your shell on many
|
|
unices with the <TT>chsh</TT> command. Since a shell is just a program,
|
|
no magic behind it, you can use damned near any program you
|
|
want as your shell. You could use Perl as your shell, I've
|
|
used clisp as a shell (just for an experiment), or you could
|
|
write your own shell.
|
|
|
|
<P>
|
|
The important thing about a shell is that most of the things
|
|
you type to it are interpreted as requests to run a
|
|
program. If you type ``<TT>ls</TT>'', you're asking your shell
|
|
to run a program called <EM>ls</EM>. If you type ``<TT>bogie
|
|
-k lap -f lap woo woo -d hickie</TT>'', you're asking it to run
|
|
a program called <EM>bogie</EM> with all that other crap as
|
|
<EM>command line arguments</EM>.
|
|
|
|
<P>
|
|
Enough about shells for now.
|
|
|
|
<P>
|
|
|
|
<H1><A NAME="SECTION00520000000000000000">
|
|
4.2 Listing Files</A>
|
|
</H1>
|
|
|
|
<P>
|
|
On unix, the <EM>ls</EM> program gives you lists of files.
|
|
|
|
<P>
|
|
If you just type ``<TT>ls</TT>'', you'll get a list of the
|
|
files in the current directory. Like this:
|
|
|
|
<P>
|
|
<PRE>
|
|
bash-2.04$ ls
|
|
#unx.tex# RCS unx.aux unx.bbl unx.blg unx.log unx.tex unx.tex~ unx.toc
|
|
bash-2.04$
|
|
</PRE>
|
|
|
|
<P>
|
|
Notice that <EM>ls</EM>, when used in this plain way, doesn't
|
|
show you files sizes or permissions or anything like that.
|
|
Unix is traditionally tery terse. Programs show you only
|
|
the information you requested, plus error messages. You
|
|
don't have progress messages like ``2003-12-06T16:16
|
|
beginning to read files'' and ``2003-12-06T16:17 reading
|
|
first file'' and other nonsense cluttering your screen. The
|
|
programs just print what's important.
|
|
|
|
<P>
|
|
If you want <EM>ls</EM> to print the details about the files,
|
|
give it the ``<TT>-l</TT>'' option. That's a minus sign (<TT>-</TT>) followed by a letter <EM>el</EM> (<TT>l</TT>). Like this:
|
|
|
|
<P>
|
|
<PRE>
|
|
bash-2.04$ ls -l
|
|
total 52
|
|
-rw-r----- 1 gene gene 9181 Dec 6 16:18 #unx.tex#
|
|
drwxrwx--- 2 gene gene 4096 Dec 6 14:03 RCS
|
|
-rw-rw---- 1 gene gene 1390 Dec 6 14:47 unx.aux
|
|
-rw-rw---- 1 gene gene 49 Dec 6 14:47 unx.bbl
|
|
-rw-rw---- 1 gene gene 878 Dec 6 14:47 unx.blg
|
|
-rw-rw---- 1 gene gene 4201 Dec 6 14:47 unx.log
|
|
-rw-r----- 1 gene gene 6387 Dec 6 14:47 unx.tex
|
|
-rw-rw---- 1 gene gene 1212 Dec 6 13:49 unx.tex~
|
|
-rw-rw---- 1 gene gene 658 Dec 6 14:47 unx.toc
|
|
bash-2.04$
|
|
</PRE>
|
|
|
|
<P>
|
|
The first column, which has all those minus signs, <EM>r</EM>s,
|
|
& <EM>w</EM>s, shows the <A NAME="tex2html7"
|
|
HREF="http://www.dartmouth.edu/~rc/help/faq/permissions.html">file permissions</A>. The next column is
|
|
the number of links to the file.<A NAME="tex2html6"
|
|
|
|
HREF="footnode.html#foot89"><SUP>4.1</SUP></A> The next column is the
|
|
user who owns the file. The next is the group of the file.
|
|
Then there's the number of bytes in the file. Then the date
|
|
the file was modified. Then the file's name.
|
|
|
|
<P>
|
|
Here's an exercise: Type ``<TT>echo *</TT>'' on the command
|
|
line, like this:
|
|
|
|
<P>
|
|
<PRE>
|
|
bash-2.04$ echo *
|
|
#unx.tex# RCS unx.aux unx.bbl unx.blg unx.log unx.tex unx.tex~ unx.toc
|
|
bash-2.04$
|
|
</PRE>
|
|
|
|
<P>
|
|
Now go figure out why or how <EM>echo</EM> differs from <EM>ls</EM>.
|
|
|
|
<P>
|
|
|
|
<H1><A NAME="SECTION00530000000000000000">
|
|
4.3 Moving Around the File System</A>
|
|
</H1>
|
|
|
|
<P>
|
|
All unix systems have a file system whose root directory is
|
|
<TT>/</TT>. Your home directory is somewhere inside a
|
|
directory in the file system. Maybe your home directory is
|
|
<TT>/home/you</TT> or <TT>/usr/hm0/you</TT> or whatever. The
|
|
details depend on the unix. To learn your home directory,
|
|
type ``<TT>echo $HOME</TT>'', like this:
|
|
|
|
<P>
|
|
<PRE>
|
|
bash-2.04$ echo $HOME
|
|
/home/gene
|
|
bash-2.04$
|
|
</PRE>
|
|
|
|
<P>
|
|
Unix has a notion of a <EM>current working directory</EM>. To
|
|
see what your current working directory is, type ``<TT>pwd</TT>'', like this:
|
|
|
|
<P>
|
|
<PRE>
|
|
bash-2.04$ pwd
|
|
/home/gene/library/website/docsrc/unx
|
|
bash-2.04$
|
|
</PRE>
|
|
|
|
<P>
|
|
To change your current working directory, use the <EM>cd</EM>
|
|
command. Give it the name of the new directory you want.
|
|
If you want to move to the current working directory's
|
|
parent, use ``<TT>..</TT>''. Here are some examples:
|
|
|
|
<P>
|
|
<PRE>
|
|
bash-2.04$ pwd
|
|
/home/gene/library/website/docsrc/unx
|
|
bash-2.04$ cd .. # move to parent
|
|
bash-2.04$ pwd
|
|
/home/gene/library/website/docsrc
|
|
bash-2.04$ cd .. # move to parent again
|
|
bash-2.04$ pwd
|
|
/home/gene/library/website
|
|
bash-2.04$ cd share # move into the "share" directory
|
|
bash-2.04$ pwd
|
|
/home/gene/library/website/share
|
|
bash-2.04$ cd /tmp # move to this absolute directory
|
|
bash-2.04$ pwd
|
|
/tmp
|
|
bash-2.04$
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<H1><A NAME="SECTION00540000000000000000">
|
|
4.4 The VI Cursor Commands</A>
|
|
</H1>
|
|
|
|
<P>
|
|
<A HREF="node5.html#editors">vi</A> is an editor, but its
|
|
cursor-movement commands are often used by other programs.
|
|
Figure <A HREF="node5.html#fig-vi-commands">4.1</A> shows <EM>vi</EM>'s
|
|
cursor-movement commands.
|
|
|
|
<P>
|
|
|
|
<P></P>
|
|
<DIV ALIGN="CENTER"><A NAME="fig-vi-commands"></A><A NAME="484"></A>
|
|
<TABLE>
|
|
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.1:</STRONG>
|
|
The cursor-movement commands from <EM>vi</EM></CAPTION>
|
|
<TR><TD><IMG
|
|
WIDTH="242" HEIGHT="99" BORDER="0"
|
|
SRC="img2.png"
|
|
ALT="\begin{figure}\begin{tabular}{\vert r\vert l\vert} \hline
|
|
{\bf command} & {\bf a...
|
|
...ve cursor up \\ \hline
|
|
l & move cursor right \\ \hline
|
|
\end{tabular}\end{figure}"></TD></TR>
|
|
</TABLE>
|
|
</DIV><P></P>
|
|
|
|
<P>
|
|
The <EM>vi</EM> commands might not make much sense at first,
|
|
but notice that you can use all of them with the fingers
|
|
from the right hand. They may not be the most mnemonic
|
|
commands, but they are very functional.
|
|
|
|
<P>
|
|
Some programs besides <EM>vi</EM> which use the <EM>vi</EM>
|
|
cursor-movement commands include:
|
|
|
|
<P>
|
|
|
|
<UL>
|
|
<LI>the mail reader called <A HREF="node5.html#mutt">mutt</A>, but just
|
|
the <EM>j</EM> & <EM>k</EM> keys in its menus
|
|
</LI>
|
|
<LI><TT>/usr/games/worm</TT>, an old game & an excellent way
|
|
to learn the <EM>vi</EM> commands
|
|
</LI>
|
|
<LI><SMALL>VIPER</SMALL>, a <EM>vi</EM>-emulator for
|
|
<A HREF="node5.html#editors">emacs</A>
|
|
</LI>
|
|
</UL>
|
|
|
|
<P>
|
|
|
|
<H1><A NAME="SECTION00550000000000000000">
|
|
4.5 E-mail</A>
|
|
</H1>
|
|
|
|
<P>
|
|
Most unix systems give you multiple options for how to read
|
|
your e-mail.
|
|
|
|
<P>
|
|
If you want to read your e-mail with a text-only program you
|
|
run from the command line (which is how I read e-mail), some
|
|
common programs are <EM>mutt</EM> and <EM>pine</EM>. Just type
|
|
the name of either of those programs. If you see a list of
|
|
e-mail, it means the program is available, & you are
|
|
running it. If you see an error message that says ``command
|
|
not found'', it means your shell couldn't find it, maybe
|
|
because it's not available on your unix.
|
|
|
|
<P>
|
|
You can figure out the basics of <EM>mutt</EM> or <EM>pine</EM>
|
|
just by using them. People become almost religiously
|
|
devoted to their favorite e-mail programs, so you can learn
|
|
more detailed or subtle ways of using a mail program by
|
|
asking someone who prefers that program. People are usually
|
|
happy to tell you more than you want to know about how to
|
|
use their favorite e-mail program. So pick one of them,
|
|
figure out the basics on your own, & then go find a
|
|
long-time user of that program & strike up a conversation
|
|
about it with him.
|
|
|
|
<P>
|
|
I've never used <EM>pine</EM>, so I can't tell you how. I
|
|
sometimes use <EM>mutt</EM>, so here is some super-quick info
|
|
on using <EM>mutt</EM>.
|
|
|
|
<P>
|
|
|
|
<H2><A NAME="SECTION00551000000000000000"></A>
|
|
<A NAME="mutt"></A>
|
|
<BR>
|
|
4.5.1 mutt
|
|
</H2>
|
|
|
|
<P>
|
|
The official documentation about <EM>mutt</EM> is at
|
|
<A NAME="tex2html9"
|
|
HREF="http://www.mutt.org/">http://www.mutt.org/</A>.
|
|
|
|
<P>
|
|
When you run <EM>mutt</EM>, you'll see a list of e-mail
|
|
messages. Each line on your screen will show a subject, a
|
|
date, & who sent the message.
|
|
|
|
<P>
|
|
One of the messages will be selected. To view the selected
|
|
message, type the Return, Enter, or Space-bar key (I can't
|
|
remember which). You'll see the body of the message.
|
|
|
|
<P>
|
|
When you are viewing the body of a message, type the Space
|
|
bar to page down. When you come to the end of the message,
|
|
type the Space bar to view the next unread message. If
|
|
there are no more unread messages, you'll see the list of
|
|
messages again.
|
|
|
|
<P>
|
|
When you are viewing the body of a message, you can type
|
|
``<TT>q</TT>'' to quit that view & return to the list of
|
|
messages.
|
|
|
|
<P>
|
|
In the list of messages, the ``<TT>j</TT>'' key moves the
|
|
cursor down & selects that message. The ``<TT>k</TT>'' key
|
|
moves the cursor up & selects that message. The ``<TT>q</TT>'' key exits <EM>mutt</EM>.
|
|
|
|
<P>
|
|
|
|
<H2><A NAME="SECTION00552000000000000000">
|
|
4.5.2 Graphical E-mail Readers</A>
|
|
</H2>
|
|
|
|
<P>
|
|
If you want to read your e-mail with a graphical e-mail
|
|
reader, maybe the one in your web browser, you'll need a
|
|
more elaborate setup. You'll need to instruct your mail
|
|
client to use your unix account for sending & receiving
|
|
messages. It sends messages via the Simple Mail Transport
|
|
Protocol (SMTP). It downloads messages that you receive via
|
|
the Post Office Protocol version 3 (POP3). Of course, the
|
|
unix system where you have your account must be configured
|
|
to allow these operations. You'll need to refer to the
|
|
documentation for that computer system to do all this, but
|
|
it can be done if the unix system allows it.
|
|
|
|
<P>
|
|
|
|
<H2><A NAME="SECTION00553000000000000000">
|
|
4.5.3 My Own E-mail</A>
|
|
</H2>
|
|
|
|
<P>
|
|
For the record, I usually use the <EM>rmail</EM> mode in Gnu
|
|
Emacs for reading & sending e-mail.
|
|
|
|
<P>
|
|
|
|
<H1><A NAME="SECTION00560000000000000000">
|
|
4.6 Viewing Files</A>
|
|
</H1>
|
|
|
|
<P>
|
|
If you have a file you want to read, use the <EM>less</EM>
|
|
program to read it. For example, if the file is called <TT>README</TT> & is in your current directory, type ``<TT>less
|
|
README</TT>''. If that gets you a ``command not found'' error,
|
|
try ``<TT>more README</TT>''.
|
|
|
|
<P>
|
|
You'll see the first part of the file on your screen. (If
|
|
it's a really short file, you'll see all of it on your
|
|
screen.) To see the next screen-full, type the Space bar.
|
|
To see the previous screen-full, type the ``<TT>b</TT>'' key.
|
|
To quit viewing the file & return to the command line, type
|
|
the ``<TT>q</TT>'' key.
|
|
|
|
<P>
|
|
|
|
<H1><A NAME="SECTION00570000000000000000">
|
|
4.7 Surf the Web</A>
|
|
</H1>
|
|
|
|
<P>
|
|
A good web browser to use on a text-only command line is
|
|
<EM>lynx</EM>. You can give it an URL to read on the command
|
|
line, like this: ``<TT>lynx http://lisp-p.org/</TT>'' or ``<TT>lynx http://google.com/</TT>''. Use the Space bar to page down,
|
|
the ``<TT>b</TT>'' key to page up, the arrow keys to select
|
|
hyperlinks, & the Return or Enter key to follow a
|
|
hyperlink. Use the ``<TT>q</TT>'' key to quit.
|
|
|
|
<P>
|
|
Unless the unix system where you have an account is very
|
|
trusting, you probably cannot run a graphical web browser on
|
|
it. Technically it can be done using the graphical system
|
|
called X (which is common on unices), setting permissions
|
|
with the <EM>xhost</EM> program, & setting your DISPLAY
|
|
environment variable, but it usually is not allowed on a
|
|
public access unix.
|
|
|
|
<P>
|
|
|
|
<H1><A NAME="SECTION00580000000000000000">
|
|
4.8 Upload & Download</A>
|
|
</H1>
|
|
|
|
<P>
|
|
|
|
<H2><A NAME="SECTION00581000000000000000"></A>
|
|
<A NAME="ftp"></A>
|
|
<BR>
|
|
4.8.1 FTP
|
|
</H2>
|
|
|
|
<P>
|
|
To transfer files between your home computer & a remote
|
|
unix, use the program called <EM>ftp</EM>. Your home computer
|
|
almost certainly has a copy, even if you run Microthought
|
|
Winders at home.
|
|
|
|
<P>
|
|
To run <EM>ftp</EM>, first go to a command line. Then type
|
|
``<TT>ftp ftp.freeshell.org</TT>'' to connect to the FTP server
|
|
at SDF.
|
|
|
|
<P>
|
|
The <EM>ftp</EM> client has a command line interface. Here are
|
|
some of the commands it understands:
|
|
|
|
<P>
|
|
<DL>
|
|
<DT><STRONG>cd <EM>directory</EM></STRONG></DT>
|
|
<DD>Change directory on the remote
|
|
FTP server.
|
|
</DD>
|
|
<DT><STRONG>dir</STRONG></DT>
|
|
<DD>Print a lsit of the files in the current
|
|
directory on the remote FTP server.
|
|
</DD>
|
|
<DT><STRONG>ascii</STRONG></DT>
|
|
<DD>Tell FTP to assume that files you transfer
|
|
are text files.
|
|
</DD>
|
|
<DT><STRONG>binary</STRONG></DT>
|
|
<DD>Tell FTP to assume that files you trnasfer
|
|
are binary files.
|
|
</DD>
|
|
<DT><STRONG>hash</STRONG></DT>
|
|
<DD>Tell FTP to print an octothorpe character (#)
|
|
for each block it sends or receives. It helps you see
|
|
the progress of the file transfer.
|
|
</DD>
|
|
<DT><STRONG>put <EM>filename</EM></STRONG></DT>
|
|
<DD>Upload a file.
|
|
</DD>
|
|
<DT><STRONG>get <EM>filename</EM></STRONG></DT>
|
|
<DD>Download a file.
|
|
</DD>
|
|
</DL>
|
|
|
|
<P>
|
|
In general, use the <EM>cd</EM> command to enter the correct
|
|
directory on the remote FTP server. Then set the correct
|
|
mode (<EM>ascii</EM> or <EM>binary</EM>). Then use <EM>get</EM> to
|
|
download a file or <EM>put</EM> to upload one.
|
|
|
|
<P>
|
|
The <EM>ftp</EM> client program supports many more commands.
|
|
Use ``<TT>man ftp</TT>'' for more information about FTP.
|
|
|
|
<P>
|
|
In case you are interested: FTP refers to the File Transfer
|
|
Protocol; it was one of the three requirements that created
|
|
the Arpa Net which became the Internet. <EM>Ftp</EM> is also
|
|
the name of the File Transfer Program which implements FTP.
|
|
|
|
<P>
|
|
|
|
<H2><A NAME="SECTION00582000000000000000"></A>
|
|
<A NAME="scp"></A>
|
|
<BR>
|
|
4.8.2 scp
|
|
</H2>
|
|
|
|
<P>
|
|
<EM>scp</EM> is the Secure Shell Copy Program. It's name is
|
|
also a reference to <EM>rcp</EM>, the Remote Copy Program.
|
|
|
|
<P>
|
|
Use <EM>scp</EM> like you would use <EM>cp</EM>, but it can copy
|
|
from one computer to another.
|
|
|
|
<P>
|
|
For example, if I want to copy <TT>myfile.cpio.bz2</TT> on my
|
|
computer into the <TT>tmp</TT> directory in my account on SDF,
|
|
I would run this: ``<TT>scp myfile.cpio.bz2
|
|
gms@freeshell.org:tmp/</TT>''. The <EM>scp</EM> program will
|
|
probably prompt me for my password, then it will copy the
|
|
file.
|
|
|
|
<P>
|
|
Run ``<TT>man scp</TT>'' to get more information about using
|
|
<EM>scp</EM>.
|
|
|
|
<P>
|
|
In my experience, <EM>scp</EM> takes longer than <EM>ftp</EM> to
|
|
transfer files, & it gives up easily. If either computer
|
|
or the network is slow, <EM>scp</EM> gives up quickly. So I
|
|
prefer <EM>ftp</EM>.
|
|
|
|
<P>
|
|
Ed Chang has told me that there is an implementation of <EM>scp</EM> for Microthought Winders called WinSCP, at
|
|
<A NAME="tex2html10"
|
|
HREF="http://winscp.sourceforge.net/eng/about.php">http://winscp.sourceforge.net/eng/about.php</A>.
|
|
I haven't tried it myself, but it sounds like it might be
|
|
pretty good.
|
|
|
|
<P>
|
|
|
|
<H2><A NAME="SECTION00583000000000000000"></A>
|
|
<A NAME="rcp"></A>
|
|
<BR>
|
|
4.8.3 rcp
|
|
</H2>
|
|
|
|
<P>
|
|
You can't use <EM>rcp</EM> on SDF, so this section applies when
|
|
copying files between other unix systems.
|
|
|
|
<P>
|
|
An old but pretty cool program for copying files between two
|
|
unices is <EM>rcp</EM>, the Remote Copy Program.
|
|
|
|
<P>
|
|
For <EM>rcp</EM> to work, you must first configure the <TT>.rhosts</TT> files in your accounts on the unix systems. Then
|
|
you can copy files from one system to another with the <EM>rcp</EM> program.
|
|
|
|
<P>
|
|
For example, if I want to copy <TT>myfile.cpio.bz2</TT> on the
|
|
local
|
|
computer into the <TT>tmp</TT> directory in my account on a
|
|
computer called <TT>overthere</TT>,
|
|
I would run this: ``<TT>rcp myfile.cpio.bz2
|
|
overthere:tmp/</TT>''. The <EM>rcp</EM> program will
|
|
copy the file; it won't ask me for my password.
|
|
|
|
<P>
|
|
|
|
<H2><A NAME="SECTION00584000000000000000">
|
|
4.8.4 When FTP Doesn't Work</A>
|
|
</H2>
|
|
|
|
<P>
|
|
If you don't have FTP on your home computer, you can
|
|
transfer files via e-mail.
|
|
|
|
<P>
|
|
First, make sure you have an e-mail account that allows you
|
|
to send files as attachments. You might use the e-mail
|
|
account that your ISP supplied with your Internet
|
|
connection, or you might create a Web e-mail account on
|
|
Yahoo!, Hotmail, or any of the many other systems that
|
|
provide free Web e-mail accounts.
|
|
|
|
<P>
|
|
To transfer a file from your home computer to SDF, you
|
|
create an e-mail message on your e-mail account that is <EM>not</EM> on SDF. Attach the file; with a Web e-mail account,
|
|
it'll allow you to upload the file into the e-ail message.
|
|
Then send the message.
|
|
Give it a minute to arrive, then login to your account on
|
|
SDF. Receive the message with an e-mail program which knows
|
|
how to deal with attached files. Mutt & pine both know
|
|
about attachments. Use that e-mail program to save the
|
|
attachment to a file.
|
|
|
|
<P>
|
|
To transfer a file from SDF to your home computer through
|
|
e-mail, login to SDF & send the file to your non-SDF
|
|
account as an attachment to an e-mail message. Then receive
|
|
the message on your non-SDF e-mail account & save the file
|
|
to your home computer's file system.
|
|
|
|
<P>
|
|
|
|
<H1><A NAME="SECTION00590000000000000000"></A>
|
|
<A NAME="editors"></A>
|
|
<BR>
|
|
4.9 Editing Files
|
|
</H1>
|
|
|
|
<P>
|
|
There are two great religions in the modern world: <EM>emacs</EM> and <EM>vi</EM>.
|
|
|
|
<P>
|
|
The two most popular file editors on unix are <EM>emacs</EM>
|
|
and <EM>vi</EM>.
|
|
|
|
<P>
|
|
<EM>Emacs</EM> is more properly called Gnu Emacs because emacs
|
|
is a way of programming file editors, & Gnu Emacs is just
|
|
one editor written in that way. I believe Gnu Emacs was the
|
|
first big production product of Gnu. Richard Stallman wrote
|
|
it himself. It is a Lisp with screen-handling functions
|
|
built-in. It's a great big powerful editor, an operating
|
|
environment, & I love it. To try emacs, type ``<TT>emacs</TT>'', wait for the screen to update, then type the
|
|
Escape key, the <TT>x</TT> key, then ``<TT>info</TT>'', then press
|
|
Return. Carefully read & follow the instructions you see
|
|
on the screen. It's kind of difficult to learn emacs from
|
|
the start, but once you do, it's great.
|
|
|
|
<P>
|
|
The other popular editor on unix is <EM>vi</EM>. I don't use
|
|
vi much. Two web sites that discuss it are
|
|
<A NAME="tex2html11"
|
|
HREF="http://www.eng.hawaii.edu/Tutor/vi.html">Mastering the VI
|
|
editor</A>
|
|
at the
|
|
Department of Engineering at the university of Hawaii,
|
|
and the <A NAME="tex2html12"
|
|
HREF="http://www.thomer.com/vi/vi.html">Vi Lovers Home
|
|
Page</A>.
|
|
|
|
<P>
|
|
<HR>
|
|
<!--Navigation Panel-->
|
|
<A NAME="tex2html191"
|
|
HREF="node6.html">
|
|
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
|
|
SRC="../img/latex2html/next.png"></A>
|
|
<A NAME="tex2html187"
|
|
HREF="unx.html">
|
|
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
|
|
SRC="../img/latex2html/up.png"></A>
|
|
<A NAME="tex2html181"
|
|
HREF="node4.html">
|
|
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
|
|
SRC="../img/latex2html/prev.png"></A>
|
|
<A NAME="tex2html189"
|
|
HREF="node1.html">
|
|
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
|
|
SRC="../img/latex2html/contents.png"></A>
|
|
<A NAME="tex2html1"
|
|
HREF="../"><IMG
|
|
ALIGN="BOTTOM" SRC="../img/latex2html/root.png"
|
|
ALT="root">
|
|
</A>
|
|
|
|
<BR>
|
|
<B> Next:</B> <A NAME="tex2html192"
|
|
HREF="node6.html">5. Learning More</A>
|
|
<B> Up:</B> <A NAME="tex2html188"
|
|
HREF="unx.html">Introduction to Unix &</A>
|
|
<B> Previous:</B> <A NAME="tex2html182"
|
|
HREF="node4.html">3. What is Unix?</A>
|
|
  <B> <A NAME="tex2html190"
|
|
HREF="node1.html">Contents</A></B>
|
|
<!--End of Navigation Panel-->
|
|
<ADDRESS>
|
|
Gene Michael Stover
|
|
2005-07-07
|
|
</ADDRESS>
|
|
</BODY>
|
|
</HTML>
|