Google
 

 

up previous next contents
Up: IntroToUnix Previous: Text Processing Next: X-Windows   Contents


Working in a Network

Objective

This section of the course teaches users to communicate electronically with other users, and with other computer systems. One of the great strengths of Unix is its' built-in networking features and it's abilities as a multi-user system.

Network-Related Commands

The following table lists the commands that are explored in this section.

UNIX Network-oriented commands.

Command  Purpose
mail     send/receive electronic mail
write    write messages to other users
talk     interactive "conversations" with other users
finger   display information about other users
who      show who else is logged in
telnet   log into other remote computer systems
ftp      file transfer protocol

Unix Mail

Unix systems have built-in electronic mail capabilities that allow you to send mail messages to users on your local machine as well as to users with accounts on other computers on your network. This is performed with the mail command.

Sending Mail

mail

To send a simple mail message to a user named joe on your local machine, use the mail command, type the desired message, and use a ^d to end the message:

$  mail joe

What do you know, joe?
^d

To send a simple mail message to a user named fred on a networked computer named jupiter:

$  mail fred@jupiter

What's up, fred?
^d

$

To send a file named document to a user named mary at a networked computer named mars:

$  mail mary@mars < document

Viewing Your Mail

To view your own mail, just type mail at the command line. If you have any mail, it will be displayed on your screen, one message at a time. Your first message is displayed, followed by a new command-line prompt. From this prompt you can now use the following commands:

Commands available within mail.

Command  Purpose
d[n]  delete mail message [number n]  (default is the current message)
h a   display all mail headers
m     mail current message to user
n     next message
p     print the mail messages
q     quit
r     [args] reply to the mail messages
s     save the mail messages
?     print help message

Writing to Another User's Terminal

The write Command

write

Depending on the permissions that have been established, you may be able to write messages to the terminal of another user(s). This is most often used by your system administrator when an important message needs to be conveyed to users. General users can use this command to send quick messages back and forth.

$  write joe

Please log off now joe (or else).
^d

$

Holding an Interactive Conversation With Another User - talk

talk

The talk command lets you hold an interactive conversation (typed) with another user. The sequence begins with a call to another user, the other user answering the call, holding the conversation, and then each user hangs up.

To call another user named betty:

$  talk betty

(waiting for betty to respond)

If betty is not logged in on the system, the system will notify you that she is not logged in.

Getting Information About Other Users - finger

finger

The finger command can be used to give you information about other users that have accounts on your computer system. To get information about a user named john:

$  finger john

Login name: john           In real life: John Doe
Directory: /home/john           Shell: /usr/bin/ksh
On since May  7 08:52:35 on pts002
New mail received Thu Apr 22 13:14:40 1993;
  unread since Thu Apr 22 13:14:39 1993
No Plan.

$ _

Who Is Logged Into the System - who

who

The who command tells you who is logged into the computer system.

$  who

fred     pts000   May  7   08:52
mary     pts001   May  7   08:59
john     pts002   May  7   09:14
joe      pts003   May  7   10:10

$

Logging in to Remote Computer Systems - telnet

telnet

Note - for security reasons, the telnet command is often replaced by the "ssh" (secure shell) command, especially when you are doing anything across the Internet..

The telnet command can be used to log in to another Unix computer. This command lets you use the resources of the other computer (CPU, memory, applications, disk space, printers) without having to physically move to another terminal.

Assume you are logged into a Unix computer, and you are also physically connected to another computer named bigbird. To use the resources of the machine known as bigbird (and assuming you have a user account on bigbird), type:

$  telnet bigbird

bigbird will respond by asking you your username and password. These are your username and password on bigbird, which can be different than your username and password on your current machine.

Once you have successfully logged in to bigbird, you will be using the resources of bigbird.

Why log into another Unix machine? bigbird may contain special applications that are not available (licensed to run) on your machine, such as Lotus 123, WordPerfect, a CAD application or a custom database application that only certain users are allowed to access.

Once you are logged in to the remote machine (bigbird), you can use your standard Unix commands to perform your work on that machine.

File Transfer Between Machines - ftp

ftp

The ftp utility (file transfer protocol) is a very standard utility that allows users to copy files between two computer systems. Most file transfer on the vast DARPA Internet are performed using the ftp command.

ftp is used to transfer files in places where file systems are not shared with NFS.

The syntax for this command is:

$  ftp remote_host

This creates a connection between you at your existing machine, and your desired remote_host. You are not able to transfer files to/from the remote host, however, until you supply the remote_host with a valid username and password for that machine.

Example:

$  ftp far_away

username:  <enter your username>
password:  <enter your password>

Welcome to "far_away"

ftp> _

At this point you can begin moving through the remote directory structure, and copying files to/from the remote host according to the permissions you are granted in each directory.

Legal commands that you canuse within the ftp utility are:

ftp Command    Description
get, mget      retrieve file(s)
put, mput      send file(s)
cd             change directory
ls             list files
? or help     (display a help screen)

Summary

In this section we learned how to use the following commands, and perform the following tasks:

Command  Purpose
mail     send/receive electronic mail
write    write messages to other users
talk     interactive "conversations" with other users
finger   display information about other users
who      show who else is logged in
telnet   log into other remote computer systems
ftp      file transfer protocol