Commands covered in this section: ftp trn mail elm pine lynx netscape
In this section we will introduce many of the most common networking utilities
provided by UNIX. The first and most commonly used is ftp.
ftp is a command interpreter which has as primary function to transfer files from one computer to another.
The most useful function of ftp is what is know as anonymous ftp, which
allow files to be exchanged between a number of users and the rest of the
world, over a public connection. Most FTP servers will provide a
directory named /pub under which are located all the publicly available
files for that site.
The fundamental steps for retrieving a file using an ftp connection are
- Open a connection to the server
- Log in
- Find the file
- Retrieve the file
- Log out
- Exit ftp
Here is a summary of the ftp commands, because
ftp acts on both the
local and the remote computers there are two sets of commands. We will
here discuss each type of command separately.
Connecting & Controlling Transfers
- open - used to open a connection, type open hostname port. The
port is optional, if you are given a port use it, otherwise
- user - Used to log into the remote computer, type
password. If you omit password the remote computer will ask
you for one. (see notes bellow for public access).
- ! - suspends ftp session and starts a subshell, the shell started
depends on the SHELL environment variable or if SHELL is not defined
will default either to sh or to your login shell (depending how your
system is set up.)
- ? or help - Used
- ? command or help command to get help on
a specific command or don't specify a command to get a list of available
- status - Displays status of ftp and show the sessions opened, transfer
mode as well as the settings of various toggles.
- close or
disconnect - Disconnects you from the current remote computer,
but remains in ftp.
- bye or quit - Disconnect from remote computer and exits from ftp
Setting various ftp Toggles/Options
The following commands are used to set various ftp toggles, this will
effect how ftp transfers files as will as how the connection is
To change the state of a toggle use toggle on (or off).
- ascii - Set to on by default, will cause all transfers to be made in
- binary - Set binary to on, when transferring any non ASCII/text file. If
you do not set binary to on and transfer a non-ASCII file it will be
corrupt and useless, you have been warned!
- glob - Set this toggle to on if you are planning to use wildcards as
*.*, if this is set to off ftp will attempt to retrieve/send a file
called *.* and not all files in the current directory.
- case - Set to off by default. If you set it to on all filenames which
are in upper case will be in lower case when transferred.
The following commands are available to deal with the directories on the
- pwd - Displays current remote directory
- cd dirname - Changes remote directory to directory specified
- cdup - Chages directory to parent of the current directory, equivalent
to cd ..
- dir remdir - List files in either current remote directory or if
you specify a directory, in the directory specified. The listing will be
in an equivalent format to ls -l
- ls remdir - Same as dir but the listing is in an equivalent
format to ls -a, it will show only the files, without attributes, but
will include all files which commence with a .
- mkdir dirname - Will create a new directory on the remote
- rmdir dirname - Removes directory specified on the remote
lcd dirname - Will change the local working directory, you can
use the usual cd options (such as cd .. would be lcd ..)
Use these commands to manipulate remote files.
- get filename - Retrieves file specified and stores it under the
same name in your current local directory. If you want to store the file
under a different name use get filename newfilename, where
newfilename is the name you want to store the file under.
- mget file1 file2 file3 ... - Retrieves multiple remote files, you
can specify as many files as you want. Wildcards can be used if the glob
toggle has been set to on.
- send file or put file - Will send the file specified to
the remote computer where it will be stored in the current remote
directory. If you want to store the file under a different name use:
- store file newfilename.
- mput file1 file2 file3... - same as put but store multiple files
on the remote computer, the same rules apply here as to the mget
- delete filename - Will delete file on remote computer
- mdelete file1 file2 file3... - Deletes multiple remote files
- rename filename newfilename - Renames file on remote computer to
- chmod mode filename - Changes access mode for specified file.
Note that the mode needs to specified as a octal value, ftp will not
accept the ASCII settings (as u-r a-x ...).
Just as ftp, internet newsgroups is a great way of communicating with
other users, as well as distributing programs.
Because of the complexity and number of uses/options of trn we will here
only cover the basics, leaving you to explore the rest. The major
difference between trn and other command line news readers is the fact
that trn supports news threads. What this means is that when a new
article is posted to a given newsgroup, it starts a new thread and each
subsequent reply is a child to the main one. This acts in much the same
way as the UNIX directory tree, where the first message is the parent
directory and each reply to that message is a subdirectory to it.
Upon starting trn, your .newsrc file will be read (if it doesn't exist
it will be created), and the newsgroups you have subscribed to will be
====== 17 unread articles in warwick.help -- read now? [ynq]
====== 07 unread articles in alt.binaries -- read now? [ynq]
At this point you can either type y to read this newsgroup (in which
case messages are displayed sequentially.), n to skip the group and move
onto the next with unread messages or q to exit trn completely.
Other options available are: by typing + to enter newsgroup threw the
selector, = to list headers before displaying articles.
To find a given newsgroup use /pattern where the pattern is the
newsgroup string you seek (this will search forward threw the newsgroup
listing, and find the group matching your string). To search backwards
use ?pattern. Typing l string will search for a newsgroup containing
the string you specified, threw the groups you haven't subscribed to (ie:
including those that are not listed in your .newsrc file).
Use the u command to unsuscribe from a newsgroup, and c to mark a thread
Using the Thread Selector
If you entered a group using the + command and the -X option at the
command line, you will be able to read the groups in a selective way,
this is particularly useful if you only want to read a small number of
To start reading a given thread, select an item to read use the letter
or number specified, and hit CR. If you do not select a thread first the
first unread one will be selected. To mark an item as killed, use either
k or a comma.
To navigate the threads the following keys are available:
Both the /pattern and other search features used to search for a given
newsgroup are available here to find threads/articles.
You can get help on any command, at any stage by simply typing h, and
you can escape to a subshell using The ! command.
Typing a q will get you out of the current level, and bring you to the
previous, so if you were reading an article and typed q you would return
to the thread selector, and a q there would take you back to the
Email is most probably the best known service the internet offers to its
users, practically everyone has an email address (referred to some as
e-address,for electronic address). This is in the following format:
Here are the different types of hostnames:
hostname.ac.uk - Defines an academic institution email
hostname.co.uk - A company based in the UK
hostname.com - A US based company
hostname.org - A non-profit making organisation
hostname.gov - A government organisation
hostname.net - A network host (most major ISPs have .net extension)
Let us take an example firstname.lastname@example.org, is my email at
ukonline. My userid is frankie.b2 and my host is ukonline, the final
extension .co.uk specifies ukonline to be a company in the UK.
Another example is Matt's address email@example.com, his userid is
csuoq, the main mail server is csv, and the host is
warwick. The .ac.uk
extension specifies warwick to be an academic institution.
UNIX Mail Readers
mail is a UNIX utility available for sending and reading of email. Use
mail -t recipient, to start mail sending a message to the person
specified as recipient. The message to be sent will be read from
standard input, until you type a . followed by a CR. on a line of its
own. Or if reading from a file it will terminate when and EOF is
When the message is sent the following header information is
The form header will specify your email address, the sender will specify
the address of your machine (usually just the hostname), then the date
and time the message is sent. Some mailers include more information in
the headers, such as the name of the mailer, a reply to address...
Note you can use any of the redirection features of UNIX with, mail. So
for example, use mail -t firstname.lastname@example.org < file1 to send file1 to john
Reading mail is just as simple, use mail -h to display a window of headers
instead of the latest message, or you can use mail -r to display
messages in a first in first out order. To view mail using another file
rather than the default use mail -f filename.
If you use mail without any options you will get a list of messages, in
a last in first out order.
When reading messages use, these commands
|-||Print previous message|
|+ or n
or Space||Print next message|
|!||Escape to shell|
|d||Delete current message and move to next|
|u||Undelete previously deleted message|
|h||Display message header|
|r user||Reply to user|
|s filename||Save message to file (default mbox)|
|x||Put all messages back in mailfile without changes and exit|
|?||Print command summery (help)|
Elm works in much the same way as does mail, however the user interface
is a bit better and it offers you menus as well as a list of available
commands for each section as you enter it.
Elm is just as extensive if not more than mail,
you can invoke elm in
three main different ways. Using elm without any arguments will start
elm in am interactive way so as to allow you to read, send, forward mail,....
You can start elm using elm -s hello mark, this would start elm directly
in the editor (see bellow for details about mail editors), where you
would be sending a message to mark with the subject hello (-s is used to
indicate the mail subject, if not specified on the command line you will
be prompted for one).
The third most common way to start elm is to
use elm -s sendingdata
mark < file.h. This would in effect mail the file called file.h to mark
with the subject being sendingdata.
Note that here mark is used as an alias (aliases can be defined from the
options menu in elm), you can use a full internet/uucp address instead,
so that elm -s hello email@example.com < file.h you also be a valid
command line invocation of elm.
Other useful command line option to elm are as follows,
elm -h or elm -?
will give you a listing of all options as well as their use, elm -f
filename will read mail from the file specified instead of INBOX,
elm -i filename will cause the file specified to be included in
the editor as part of the outgoing message, and elm -z will check if
there is new mail, if not elm won't start.
Like mail and elm,
pine is an Internet mailer, but pine is also a
newsreader. Reading news or email is achieved in exactly the same way,
with the exception that when reading mail, it will be read from either
the INBOX or a mail folder, but the news is read either directly from
the news server or from a news spool file (depending on your set-up).
Pine is designed to be highly interactive, it is very easy to use, and
the menu navigation is well implemented. All you really need to do is
use your arrow keys and the spacebar or CR to navigate threw the
messages. One major advantage to pine is that it will flag your messages
as read, answered, urgent, important or new. You can set your own flag
by using the + when reading your messages and then execute macros on
To start pine just type pine. If you want to start
pine directly in the
editor, use pine eaddress where eaddress is the internet
address of the recipient (pine does not deal with UUCP mail properly, if
you want to use UUCP use elm). If you use
pine -f folder, this
will cause pine to read your mail from the specified folder instead of
the default mailbox, pine -i will start pine in the FOLDER INDEX so that
you can start selecting mail to read immediately, pine -h displays all
commands available as well as their usage, pine -F file will
display file in pine's editor, pine -sort sort string will cause
pine to sort messages in the order specified (valid orders are, arrival,
subject, from, date, size, orderdsubj or reverse, add /reverse if you
want to sort in reversed order).
There are many specialised functions in pine as well as in the other
mailreaders, to find those out read the online help files provided with
To change the editor used by the mailers you will need to set an
environment variable. EDITOR=whatever editor you like to use can
be any valid editor such as those described in the former sections.
EDITOR=emacs or EDITOER=jove are but two examples.
Note that when using pine the default editor has a wrap facility, which
can be very useful.
The World Wide Web
The WWW is an internet form of document/information distribution which
is growing in both popularity and importance, initially it could handle
on text, but has now expanded to contain not only graphics but sounds as
well as fully interactive contents, such as programs, grams,
There are many browsers about, but here we will just briefly
mention two, Lynx and Netscape. Lynx is a text based browser and can
handle only textual documents, ignoring anything else, as such it has
greatly decreased in popularity, but it is still used on systems which
do not support full graphical displays.
Type lynx, and you will get a hypertext document describing how to use it
as well as a list of links where you can find more detailed information
about the browser. Navigation is relatively simple use the numbers keypad as illustrated in the diagram:
To go to a specific URL use g, this will bring up a prompt asking you
for the url, type it in and press CR. Lynx will then open the documents
Use m to go back to the starting document, i to view an index of
documents and o to go to the options menu from where many other more
details functions of lynx can be used.
Netscape will not run under the command line in UNIX you will need to
use the X Windows System to be able to run Netscape.
Once under X simply type netscape or on some systems you can use a
specific version of netcsape by adding it to the name of the executable
as netscape-2.0 (this will start version 2).
Netscape supports all the latest tricks of the HTML trade, such as
sound, video, executable content and scripting. Because of its graphical
nature navigation is very simple. Use the scroll bars to scroll threw a
document, the reload button to reload a page, and type the URL in the
box provided, or simply use the Open Location (from the file menu) to open a URL. You can use
Open File to open a local file.
One thing to note when using Netscape, is that because most web pages are
highly graphical in content, netscape will eventually use all the
colours available on your system, and starting any other application
which requires colours will result in either distorted colours or the
application not starting. To prevent this type the following when
invoking netscape netscape -install. This will prevent netscape taking all the colours
and you may use other applications which requires colour (such as a
Netscape also allows you to read your Mail and News from within its
environment, to use these options you should select the mail and new preferences option from
the options menu, to set your email (found under the Identity tab) and the specific servers to use
(These might be set-up for you already but you will still have to enter
your email address).
To learn how to use Netscape in depth just use the options provided in
the Help menu, which will take you to on line documentation and
Last modified: Sun Aug 10 15:52:02 BST 1997