Internet Title

Commands covered in this section: ftp trn mail elm pine lynx netscape

Transferring Files

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 as follows:

  1. Open a connection to the server
  2. Log in
  3. Find the file
  4. Retrieve the file
  5. Log out
  6. 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

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 effected.

Remote Directories

The following commands are available to deal with the directories on the remote computer.

Local Directories

lcd dirname - Will change the local working directory, you can use the usual cd options (such as cd .. would be lcd ..)

Remote Files

Use these commands to manipulate remote files.

Reading NewsGroups

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.

NewsGroup Thread Map

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 displayed as:

====== 17 unread articles in -- 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 as read.

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 messages.
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:

Key Map

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 newsgroup selector.

Electronic Mail

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:

Let us take an example, is my email at ukonline. My userid is frankie.b2 and my host is ukonline, the final extension specifies ukonline to be a company in the UK.
Another example is Matt's address, his userid is csuoq, the main mail server is csv, and the host is warwick. The 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 read.
When the message is sent the following header information is generated:
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 < 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 SpacePrint next message
!Escape to shell
dDelete current message and move to next
uUndelete previously deleted message
hDisplay message header
r userReply to user
s filenameSave message to file (default mbox)
xPut 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 < 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.

Introducing Pine

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 them.

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 each mailer.


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, videos....
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:

Number KeyMap

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 for you.
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 paint program).

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 tutorials.

< Previous: Process Control ^ Next: Other Network Commands >

Frankie Blaskovic
Last modified: Sun Aug 10 15:52:02 BST 1997