Introduction to UNIX
Network Related Utilities Exercises


ftp

Anonymous FTP will be used to connect to an Internet computer which contains an image file representing a Van Gogh painting. The file will first be downloaded and then an image viewing utility will be used to display the image file on your screen.

  1. Create a new window or use an existing window. Type the following command in that window:
     
         ftp kanaha.mhpcc.edu 
         
  2. As the network connection is established with the server computer you will see several messages appear on your screen. You will then be prompted to enter your Name. Type the name anonymous and hit return.

  3. You will then be prompted to enter a Password. Type the password guest . You will then see a couple messages. At the bottom of the screen, you should see the prompt: ftp> . This means that ftp is now ready to accept commands from you.

  4. View the top level file directory by typing the command: dir . This shows a typical UNIX long directory listing. The important column is the last one on the right which shows the file names. The ls command can also be used to give a short directory listing.

  5. Change directory to the pub subdirectory, list the files, and then change to the Misc subdirectory and list its contents by using the following commands:
    
         cd pub
         dir
         cd Misc
         dir
         

  6. You should see a file called starry.night.gif . If you do, you are now ready to download the file. Use the command:
     
         get starry.night.gif 
         
    When the download is complete you will see a message that looks something like this:
         226 Transfer complete. 
         273663 bytes received in 1.243 seconds (220.2 Kbytes/s)
         ftp> 
         
  7. Quit your ftp session by typing the quit command.

  8. The file which you downloaded is a GIF (Graphical Interchange Format) image file - a very common file type for images on the Internet. Being able to view the file on your local computer requires that you have software which can display GIF type files. One such UNIX utility is called "xv". Use "xv" to display your downloaded file by typing the command:
     
         xv starry.night.gif 
         
  9. When you are done viewing your image, left-click on the image with your mouse and then type the letter Q for quit.

  10. This completes the FTP exercise. Return to the tutorial to learn about the next section before proceeding.

    telnet

    The telnet utility will be used to connect to another machine and login.

    1. Create a new window or use an existing window. Type the following command in that window, substituting a classroom machine name for nodeXX (node1-node16). Please use a machine other than the one you are currently logged into.
       
           telnet nodeXX.class.mhpcc.edu
           

    2. You will be asked to login - use your assigned userid and password. Be sure to type n when asked to start mosaic.

    3. After you login, list your home directory. Looks familiar? Because all of the classroom machines share the same user filespace, you can log into any classroom machine and have your files visible.

      If you had an account on a non-MHPCC machine, your files there would local to that system.

    4. Use logout or exit to quit this telnet session and return to your original login machine.

    5. This completes the telnet exercise. Return to the tutorial to learn about the next section before proceeding.

      rlogin, rcp, rsh

      This exercise will familiarize you with the remote login, remote copy and remote shell commands.

      Creating a .rhosts file

      1. Create a new window or use an existing window. Make sure that you are in your home directory by typing the cd command.

      2. Use an editor to open a file called .rhosts and add the following lines to this file, being sure to substitute your student userid for "myuserid".

        HINTS: You can type in all 16 lines if you want, OR, you could:

        • Read in the file ~/Scripts/node.names and just add your userid to each line
        • Use your editor's "cut and paste" capabilities. Just type one line and then cut and paste it 15 times. All you'll need to change then are the line numbers.
        • If you know how to use the mouse for cutting and pasting between windows, it's even easier. Just cut from this window and paste into the window which contains your editing session. Then change the "myuserid" on each line.
        
             node1.class.mhpcc.edu  myuserid
             node2.class.mhpcc.edu  myuserid
             node3.class.mhpcc.edu  myuserid
             node4.class.mhpcc.edu  myuserid
             node5.class.mhpcc.edu  myuserid
             node6.class.mhpcc.edu  myuserid
             node7.class.mhpcc.edu  myuserid
             node8.class.mhpcc.edu  myuserid
             node9.class.mhpcc.edu  myuserid
             node10.class.mhpcc.edu  myuserid
             node11.class.mhpcc.edu  myuserid
             node12.class.mhpcc.edu  myuserid
             node13.class.mhpcc.edu  myuserid
             node14.class.mhpcc.edu  myuserid
             node15.class.mhpcc.edu  myuserid
             node16.class.mhpcc.edu  myuserid
             
      3. Write the file to disk and exit the editor.

      4. Make sure that the permissions on your .rhosts are set so that only you can read/write the file:
        
             chmod 600 .rhosts
             

      Remote login

      1. Think of a machine other than the one you are logged into (node1-node16).

      2. Then, use the remote login command to automatically login to the machine you picked. For example:
        
             rlogin  nodeXX.class.mhpcc.edu
             
        You will notice that you are able to login without entering a userid or password. Be sure to type n when asked to start mosaic.

      3. Logout of the machine you just accessed

      Remote copy

      1. Think of a machine other than the one you are logged into (node1-node16).

      2. Use the remote copy utility to copy one of your files to another machine's temporary filespace. An example of what you might do appears below. Be sure to substitute your chosen machine for "nodeXX" and your student userid for "studntXX".
        
             rcp  ~/Editors/maui.txt  nodeXX.class.mhpcc.edu:/tmp/studntXX.maui.txt
             
      3. You will verify that the copy actually took place with a remote shell command in the next exercise.

      Remote shell

      1. Using the same machine as you did for the remote copy command, remote shell to that machine and list the contents of its temporary directory:
        
             rsh nodeXX.class.mhpcc.edu  ls -l /tmp
             
      2. You should see the file you copied from the remote copy exercise.

      3. Now, use rsh to remove that file - don't forget to substitute your userid for "studntXX":
        
             rsh nodeXX.class.mhpcc.edu  rm  /tmp/studntXX.maui.txt
             

      4. Finally, use the remote shell command to look at all of the other machine's student processes:
        
             rsh nodeXX.class.mhpcc.edu  ps aux | grep studnt
             

      5. This concludes the Network exercises. Return to the Network tutorial or to the Table of Contents.