Introduction to UNIX
Getting Started Exercises


Logging On To The System

The details of logging in to a UNIX computer will differ from system to system. The steps covered here are specific for the MHPCC classroom.

  1. The instructor will assign every student a unique userid and password. Make sure you know yours before proceeding. The instructor will also show you how to setup your terminal for logging on.

  2. After your computer terminal is ready for logging on, review the screen and look for a place to type in your userid and password.

  3. Type in your userid, making sure that you distinguish between uppercase and lowercase letters as required. Press the return key when finished.

  4. Type in your password, also making sure that you distinguish between uppercase and lowercase letters as required. It will not appear as you type for security reasons. Press the return key when finished.

  5. If you are unsuccessful at logging in, the system will give you another try. Keep trying until you succeed. If you don't succeed after 5 tries, call the instructor.

  6. After you have successfully logged in, the system will automatically create your initial environment including a clock and a window for entering commands.

  7. Notice the window - it should ask you which type of session you want. Answer the prompt by typing in the number which matches: Introduction to UNIX. You will then be prompted to "start Netscape" - type y for yes.

  8. After a few seconds, you should see the Introduction to UNIX window. If you do not, call the instructor.

  9. Return to the tutorial to learn about the next section before proceeding.

Using UNIX Commands

This exercise will familiarize you with the basics of issuing UNIX commands.

  1. You should still have a window on your screen from the previous exercise. Select that window by dragging the mouse pointer into the window and then clicking with the left mouse button. The window is now ready to accept input from you.

  2. Try a few simple commands which require no arguments or options:
    
         date      - show date and time 
         whoami    - show your userid 
         who       - show who is logged onto the system 
         w         - show who is logged onto the system 
         pwd       - print the working directory's name 
         clear     - clear the screen 
         

  3. Now try some commands which require arguments and/or options:
    
         ls -a                - list all files in current directory  
         ls -al               - long list of current directory  
         cat .cshrc           - display contents of .cshrc file 
         mkdir dir1           - make a directory called dir1 
         cd dir1              - change directory to dir1 
         cd ..                - change to parent directory  
         rmdir dir1           - remove directory dir1 
         cp .login new.login  - copy the .login file to new.login 
         wc new.login         - count the lines, words and 
                                characters in the new.login file 
         wc -l new.login      - count just the lines 
         rm new.login         - remove the new.login file 
         
         

  4. Try using multiple commands on one line. Don't forget to include the semi-colon between commands.
    
         cp .login testfile ; cat testfile
              - copy a file and then show its contents 
    
         ls -l testfile ; rm testfile ; ls -l testfile
              - list (long) a file,  remove it, and then try to 
                list it again 
         

  5. Return to the tutorial to learn about the next section before proceeding.

Special Characters

This exercise will acquaint you with the use of several of the UNIX special characters.

  1. First, make sure you are in your home directory (issue the "cd" command with no arguments). Now "cd" to this exercise's subdirectory by using the command:
    
         cd GetStart
         

  2. Using the "*" wildcard character, list all of the files in this subdirectory:
    
         ls *
         

  3. Using the "?" wildcard character, list all files with 3 character names:
    
         ls ???
         

  4. Using square brackets and wildcard characters, try listing files several different ways:
    
         ls [a-c]* 
         ls [abcde]* 
         ls [a-z]*
         ls [z]*
         ls ??[c]* 
         ls ?[e]*
         

  5. Using the right angle bracket ">" and the semi-colon ";", concatenate three files into a single new file and then display it:
    
         cat alpha beta gamma  >  newfile ; cat newfile
         

  6. Return to the tutorial to learn about the next section before proceeding.

Terminal Control Keys

This exercise will familiarize you with several of the terminal control keys used by UNIX.

  1. Erasing the command line: At the command prompt, begin typing several characters. It doesn't matter what you type (but don't press the Return key) because you will then erase the line by typing CTRL-u.

  2. Killing a command: Start the command sleep 300 which simply "sleeps" for 300 seconds. After it is started, try using another UNIX command such as "ls". What happens? Kill the sleep process by using CTRL-c, and try it again. What happens now?

  3. Backspacing: At the command prompt, begin typing several characters. It doesn't matter what you type (but don't press the Return key). After typing several characters, try using CRTL-h to backspace. Most keyboards will allow you to backspace by using a "backspace" or "delete" key also.

  4. Screen Scrolling: Issue a command which will send lots of information to the screen: ls -R / While the information is being displayed, use CTRL-s to stop it and then CTRL-q to restart it. Try CTRL-s and CTRL-q a couple times. Then kill the process with CTRL-c.

  5. Return to the tutorial to learn about the next section before proceeding.

Changing Your Password

This exercise will familiarize you with changing your password on a UNIX system.

  1. Each student should have received an initial password from the instructor. If you are not sure of yours, ask the instructor.

  2. Think of a new password which follows the guidelines mentioned in the tutorial. Remember what it is.

  3. Change your initial password by issuing the passwd command. As your are prompted, supply your old password and then your new password. You will be asked to type the new password twice for confirmation. Notice that nothing appears on the screen as you type.

  4. Now change your password back to the original password. Please don't forget to do this step!

  5. Return to the tutorial to learn about the next section before proceeding.

Getting Information

This exercise will familiarize you with several different UNIX utilities for obtaining information about the system.

  1. Use the man command to read in depth about some common UNIX utilities:
    
         man ls
         man cp
         man rm
         man man
         

  2. Use the following commands to find out about users on the system, including yourself:
    
         who
         whoami
         who am i
         finger
         finger your userid
         

  3. Return to the tutorial to learn about the next section before proceeding.

Logging Off The System

This exercise will familiarize you with logging off a UNIX system - in particular, an MHPCC training system. Note that this procedure may differ from system to system.

  1. In your open window, type either of the following commands to logout:
    
         logout
         exit
         

  2. This will cause your window to disappear. In other UNIX systems, without a windows environment, these same commands would terminate your entire session.

  3. This concludes the "Getting Started" Exercises. Return to the Getting Started tutorial or to the Table of Contents.