Basic UNIX 

What happens after you successfully login depends upon your system:

Your Home Directory


Using UNIX Commands

This exercise will familiarize you with the basics of issuing UNIX commands. For more information on each of these commands, refer to the "man" pages. Using the command "man command name". More information on the man command is given later in this section. Refer to the getting information section for a description of the man command.

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

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

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

  4. You can get more information on the various types of UNIX commands here .

Special Characters

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

  1. Using the "*" wildcard character, list all of the files in the present working directory:
    
         ls *
         

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

  3. 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]*
         

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

  5. You can get more information on special characters here .

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. You can get more information on terminal control keys here

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. If you are not sure of yours, ask the instructor.

  2. Think of a new password. 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!

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. Refer to tutorial to know more about these commands.

Logging Off The System

This exercise will familiarize you with logging off a UNIX system - in particular, the systems used in the center. 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. On the SUN and the DEC workstations, move the mouse outside the X window and press the left button. Go to the logout option and relaase the mouse button. This will log you out of the session.