Home | Services A–Z | Help & Tutorials
You Are Here:Home > Infrastructure Services > VTAIX > Communicating with Other Users and Other Systems

Communicating with Other Users and Other Systems


  1. Identifying System Users
  2. Using the mail Command
    1. Sending Mail
    2. Reading Mail
  3. Using the elm Mailer
    1. elm Commands
    2. elm Options
    3. Sending Mail
    4. Reading Mail
  4. Networking (telnet, tn3270, and ftp)
    1. anonymous ftp Example
    2. Network File Storage Formats


Identifying System Users

The who and finger commands can be used to obtain information about individuals on VTAIX. Observe the results of entering the following commands:

    who am I
    	whoami
    	who
    	who  |  wc -l
    	finger
    	finger  $HOME
    	
"who | wc -l" pipes the output from the who command to the wc command with the "-l" and thus returns the number of logged on users.


Using the mail Command

Use the mail command to compose and send notes to other userids.

Sending Mail

To compose and send mail to another userid on VTAIX, use:

    mail their_userid
    	

To send mail to a userid at a node other than VTAIX, use the command:

    mail their_userid@their_node
    	
When you enter the mail command followed by a userid, you will be prompted to enter a subject. After you have typed in the subject, press the <Return> key and you are ready to begin entering the text of your message. To end the message, press <Ctrl-D>. mail will then display the "Cc:" prompt for any additional userids to whom you would like to send copies. You may enter one or more userids, or just press the <Return> key to send the note.

Alternatively, you can use the mail command to send an existing file to another user. For example, to send a copy of "file_name" to aixstu00, enter:

    mail  aixstu00  <  file_name
    	

The following mail commands can be used when sending messages:

~q
quit without sending mail message
~v
activate the vi editor
~p
display the headers and messages in the current mail message.

Reading Mail

The mail command is also used to read mail others have sent to you. If you have incoming unread mail when you logon, the system will notify you by displaying the message:

    You have new mail.
    	
To view your mail, enter the mail command without any arguments. mail will display a list of headers for the mail items you have received followed by the & prompt. Press enter to read each of your mail items. Once the last note has been displayed, mail will display "at EOF". You may now exit the mail program by entering quit or by pressing <Ctrl-D>.

Some of the most commonly used commands used when reading mail are:

<Return>
read the next message.
?
displays list of mail commands.
h
list the subjects (headings) of incoming mail messages.
#
select message number "#".
r
send a reply to sender and all recipients.
R
send a reply only to the sender of the message.
s
save (append) mail message to a file.
w
write message to specified file.
v
edit current message using vi.
d
delete a message (or list of messages specified by number or range of numbers).
q
exit (quit) from mail.
x
exit (quit) from mail without changing the original contents of your mailbox.


Using the elm Mailer

Several individual have found the elm mailer to be easier to use than the standard mail command. To start the elm mailer, simply enter: elm

For documentation on use of elm, enter: man elm

The first time, you will be asked a few questions to define the default mailer environment. A screen listing the files in your mailbox will then be displayed and you can selected the file by moving the highlighted bar and select an option by letter.

elm Commands

?
request help
j
move the file selection cursor down
k
move the file selection cursor up
m
mail a new message
r
reply to an existing message
d
delete the message
u
undelete the message

elm Options

To change the default options, enter the command o when the elm index menu is displayed.

You should check the following items:

E)ditor
Is the path to vi or other editor correct (/bin/vi on VTAIX)?
P)rint
On VTAIX this option should read "lpr %s", check with your system administrator for the correct options on other systems.
U)ser level
You may wish to change this to "Intermediate" as it displays more commands on the index menu.
The elm options are stored in the file elmrc. To determine where this file is stored, enter the following command from your root directory: find . -name elmrc -print

Sending Mail

Send a copy of the file "cars" to each of the members in the class:

  • source define_classids
  • mail $classids < cars

    Use "mail" or "elm" to send a message to yourself and at least two other individuals.

    Reading Mail

    Use "mail" or "elm" to review the messages sent by yourself and others.


    Network Commands

    Use of the networking commands telnet, tn3270, and ftp are described in Introduction to Networking, Using AIX. (Virginia Tech Computing Center User's Guide, NK08) and are briefly summarized below:

    telnet
    remote logon

    tn3270
    remote logon to VM/CMS systems

    ftp
    file transfer protocol

    On occasion, the Computing Center also presents a short course in networking entitled: Introduction to Internet & BITNET. Call 231-9500 for information on availability of this course.

    Example Usage - anonymous ftp

    The following example illustrates how you can copy the file ax01 (Virginia Tech Computing Center documentation for VTAIX) from ftp.vt.edu. You begin from the shell prompt (typically "$" for Bourne or Korn Shell, or "%" for the C Shell); the example illustrates beginning from the Bourne or Korn Shell.

      +----+------------------------+---------------------------------------+
    	  |LINE|YOUR SCREEN DISPLAYS    |YOU TYPE / YOUR ACTION                 |
    	  +----+------------------------+---------------------------------------+
    	  |1   |$                       |ftp  ftp.vt.edu                        |
    	  +----+------------------------+---------------------------------------+
    	  |2   |Several connection mes- |anonymous                              |
    	  |    |sages.  Then prompts    |                                       |
    	  |    |for the name of the     |                                       |
    	  |    |userid you would like   |                                       |
    	  |    |to access.              |                                       |
    	  +----+------------------------+---------------------------------------+
    	  |3   |Requests the logon      |your_userid@VTAIX.CC.VT.EDU            |
    	  |    |password.               |                                       |
    	  +----+------------------------+---------------------------------------+
    	  |4   |Message indicating the  |cd pub/cc/docs/guides                  |
    	  |    |userid has been ac-     |                                       |
    	  |    |cessed.  Prompts for    |                                       |
    	  |    |the next command.       |                                       |
    	  +----+------------------------+---------------------------------------+
    	  |5   |Message indicating that |ls                                     |
    	  |    |you have changed to the |                                       |
    	  |    |new directory.  Prompts |                                       |
    	  |    |(typically "ftp>") for  |                                       |
    	  |    |the next command.       |                                       |
    	  +----+------------------------+---------------------------------------+
    	  |6   |Display files in the    |get  ax01  aix.doc                     |
    	  |    |current directory.      |                                       |
    	  |    |Prompts for the next    |                                       |
    	  |    |command.                |                                       |
    	  +----+------------------------+---------------------------------------+
    	  |7   |Messages indicating the |You have now successfully copied the   |
    	  |    |file transfer is com-   |file to the accessed disk and can is-  |
    	  |    |plete.  Prompts for the |sue any other valid FTP commands.  To  |
    	  |    |next command.           |exit from ftp, enter:  quit            |
    	  +----+------------------------+---------------------------------------+
    	  +                                                                     +
    	  +----+----------------------------------------------------------------+
    	  |LINE|NOTES                                                           |
    	  +----+----------------------------------------------------------------+
    	  +----+----------------------------------------------------------------+
    	  |4   |o   You can now issue any valid ftp commands.  In this example, |
    	  |    |    we have changed to the directory containing the file ax01.  |
    	  |    |    If we were unfamiliar with the directory structure or the   |
    	  |    |    files available, we could have entered the command "ls" to  |
    	  |    |    list the current directory.  We could then issue the "cd"   |
    	  |    |    command at the next prompt to change into any of the avail- |
    	  |    |    able directories.  Since we are already familiar with the   |
    	  |    |    directory structure, we can specify the full path of the    |
    	  |    |    directory containing the file we wish to download.          |
    	  +----+----------------------------------------------------------------+
    	  |5   |o   If you only wanted to list the files beginning with the     |
    	  |    |    letter a, enter:  ls a*                                     |
    	  |    |o   At this point it may be necessary to issue additional "cd"  |
    	  |    |    and "ls" commands to locate the directory containing the    |
    	  |    |    file(s) you wish to download.                               |
    	  +----+----------------------------------------------------------------+
    	  |6   |o   On many systems, you can simply use the command "get        |
    	  |    |    filename", where filename is the name of the file you would |
    	  |    |    like to copy;  it will be copied to the current working di- |
    	  |    |    rectory using the same name as the source file.  Some sys-  |
    	  |    |    tems require that filenames be enclosed in quotes and a few |
    	  |    |    systems require that you also specify a destination file    |
    	  |    |    name which is different from the source file name.          |
    	  |    |o   On many systems, you can use the "mget" command to download |
    	  |    |    multiple files.  For example, to download all files begin-  |
    	  |    |    ning with "a*", enter:  mget a* The name of each file meet- |
    	  |    |    ing the specified filename criteria will be listed and you  |
    	  |    |    will be asked (y or n) if you wish to get this specific     |
    	  |    |    file.  If you "mget" files from VM/CMS or VAX/VMS systems,  |
    	  |    |    the files will typically be transferred with all uppercase  |
    	  |    |    names.                                                      |
    	  +----+----------------------------------------------------------------+
    	  |7   |o   You can issue additional "cd", "ls", or "get" commands.     |
    	  |    |o   When you are finished copying files and ready to return to  |
    	  |    |    your VTAIX session, enter:  quit                            |
    	  +----+----------------------------------------------------------------+
    	

    Feel free to experiment with the "ls", "cd", and other ftp commands to navigate among the files available on the anonymous ftp server.

    You can only use the "put" command if you have write access to the logged on userid.

    Network File Storage Formats

    Files can be stored in ASCII or Binary formats. Be sure that you use the appropriate file transfer mode for each file you 'get' or 'put'. The default transfer format for most systems is ASCII and is appropriate for text files such as program source code and input data files. Use the command binary or image to transfer all future files in binary format; use the command ascii to indicate that all future files are to be transferred in ASCII format.

    tar Files

    Files ending in ".tar" are in tape archive format and should be transferred as binary files.

    To create a tar file from a list of files (or files within a directory), use the options "-cvf". For example, to create an archive file containing the files page1 and page2, enter:

      tar  -cvf  archive_name.tar  page1 page2
      	
    When a directory is specified, the contents of any subdirectories will be included in the tar file and the subdirectory structure will be preserved when the archive is extracted. We will also create a second tar file containing all of the files in the "c" subdirectory:
      tar  -cvf  archive2_name.tar  c
      	

    If you would like to list the table of contents of a tar file, e.g., before unarchiving it, you can use the options "-tvf", e.g.:

      	tar  -tvf  archive_name.tar
      	

    You can use the -xvf option to extract the contents of a tar file. So that we can better observe how the extraction of a tar file operates, we will move the two tar files we have created into a new directory before extracting them:

      mkdir temp
      	cd temp
      	mv  ../*.tar  .
      	tar  -xvf  archive_name.tar
      	

    Files ending in ".Z" are in compressed format and should be transferred as binary files. You can use the uncompress command to restore the file to its original format. As an exercise, we will first compress the two archive files we have created:

      compress  archive_file.tar
      	compress  archive2_file.tar
      	ls
      	

    Files ending in ".tar.Z" are in compressed tape archive format. You can use the following command to extract the files from "archive_name.tar.Z":

      uncompress  archive_name.tar.Z  |  tar  -xvf  -
      	ls
      	

    Note: The final dash is used to indicate that the tar command is to use piped output as its input.

    Use the command zcat in place of uncompress (or the -c option of uncompress) if you wish to retain a copy of the original compressed file after extracting the component files, for example:

      zcat  archive2_name.tar.Z  |  tar   -xvf  -
      	ls;  ls  c
      	

    An additional Exercise Using "tar" Files is available if you would like to practice using tar files.

    Encoded Files

    Sometimes characters in binary files are incorrectly translated when files containing them are sent across the network. To prevent this from happening, binary files are often converted to an alternative (typically on the order of 30% larger than the original file) form in which each of the component characters is stored in a coded format. The encoding characters typically consist of keyboard characters which are usually immune to being translated incorrectly between systems. Most UNIX systems provide the uuencode command to create encoded files and the uudecode command to convert uuencoded files back into their original format. Uuencoded files should be transferred as ASCII files.

    To encode file_name using uuencode on VTAIX, enter:

      uuencode  file_name remote_name  > encoded_file_name
      	
    where "remote_name" is the name you would like to have assigned to the file when it is decoded and "encoded_file_name" is the name of the file you would like to create containing the uuencoded version of file_name. If you are using a system other than VTAIX, check the online documentation for details on using uuencode on your system.

    To decode a uuencoded file, simply use the command uudecode followed by the name of the file you wish to decode. For example, to decode the contents of "encoded_file_name", simply enter the command:

      uudecode  encoded_file_name
      	

    An additional Exercise Using "UUENCODED" Files is available if you would like to practice using uuencoded files.

    shar Files

    The shar format is a "SHell ARchive" format. A shar file is a UNIX shell script that extracts one or more files from within its body and optionally executes additional shell commands. The processing done by the scripts can vary greatly, and may include, for example, compiling source or uudecoding files. Shar files usually have a .shar extension and can usually be transferred as text. A shell archive may consist of more than one file.

    It is wise to examine the commands in shar files to check that they contain no malicious code and that they won't accidently destroy any of your directories or files. The first few lines of the file typically explain the purpose of the file and how to extract its contents. The contents are typically extracted using the command "sh" followed by the name of the shell archive. Some shell archives consist of multiple files and may have to be extracted in a particular order. Read the descriptive information in each of the component SHAR files carefully.

    A shar command is found on some UNIX systems; the bin directory of the course instructor's account contains the shell script sshar which can be used to create shar files. We will use this shell script to create a shar file containing the source code for the program "statsall" described in Using Multiple Source Files.

      ~aixstu00/bin/sshar statsmain.f included means.f std.f > f.shar
      	

    As stated previously, a shar file may include additional commands. Add the following lines to the end of "f.shar" to enable it to compile and execute the code contained in these files:

       echo
      	 echo Compiling program statsall:
      	 xlf  -o  statsall  statmain.f  means.f  std.f
      	 echo
      	 echo Executing program statsall:
      	 ./statsall
      	
    Whenever you create a shar file, it is recommended that you include comments to describe how to extract the contents of the archive.

    Recall: In vi, you can use the command <G> to go to the bottom of the file.

    So as not to overwrite any of the existing files when we extract the files from the shell archive, we will create a new directory and copy the shell archive here before extracting its contents.

      mkdir temp2
      	cd temp2
      	mv ../f.shar .
      	sh  f.shar
      	
    Observe that the last command extracted each of the files in the archive, compiled the FORTRAN source code, and then executed the program to print a line of output on the screen.

    In the preceding examples, we have shown how shar files can be used to archive a series of files. Since the Internet limits the size of mail files to approximately 300k, any large files must be broken into smaller components prior to being mailed. The "split" command can be used to conveniently break a large file into pieces and a shell script can then be written to reassemble the pieces in their proper order. If you are mailing binary files, you should uuencode them prior to splitting.

    The shar file format is convenient for sending large files by mail as this format incorporates both the contents of files and the instructions for extracting them within the shar archive. The extraction instructions can be made as complex as desired, including error checks, to make sure that the component pieces are properly decoded and then reassembled.

    As a practice exercise, we will copy some files from the course instructor's userid and assume that these files represent the contents of three mail messages which we have received and written to disk, i.e., using the w option of the mail command. Observe the result of the following commands:

      cp  ~aixstu00/shar/*  .
      	sh  xxa.shar
      	
    This command will complete a series of steps to extract, recombine, and uudecode the files contained in the archive. If there are no errors, you should now find a copy of the files "my_source.c" and "my_source" in the directory "new_dir2". If your userid is on VTAIX or another RS/6000, you should be able to execute the program by entering:
      	 ./my_source
      	
    Otherwise you can recreate the executable program by recompiling my_source.c

    An additional Exercise Using "shar" Files is available if you would like to practice using SHAR files.

  • 0
    Communicating with Other Users and Other Systems Tasks
    Request a VTAIX ID
    Change your VTAIX password
    Review VTAIX documentation
     
    Related Topics
    VTAIX ID
     

     

    Last updated on February 22, 2002
    Request Help | Site Feedback | Disclaimer | Privacy Statement