Cabrillo College


Objectives

The purpose of this lab is to explore command usage with the shell and miscellaneous UNIX commands.

Forum

If you get stuck, have a question or want to share something you learned with this lab then use the CIS 90 Forum at http://simms-teach.com/forum/viewforum.php?f=17

Procedure

You must log on to the Opus server using your personal account acquired from turning in lab01. The following questions pertain collectively to the following unix commands:

banner bash bc cal clear date echo exit finger history id man passwd ps type uname whatis who

Print out a copy of this lab and use it to record the answers to the questions in the lab. You don't need to record the output of the commands.

    The Shell

  1. What shell are you currently using? What command did you use to determine this?
     
  2. Use the following commands as arguments to the type command, to find out where each of the commands resides.
        cmd               argument
        type     man
        type     uname
        type     tryme
        type     echo
        type     type
    
  3. Use the echo command to find the values of each of the following shell variables.
    	echo $HOME
    	echo $TERM
    	echo $LOGNAME
    	echo $PS1
    	echo $SHELL
    	echo $PATH
    
  4. Set the TERM environment variable to "dumb", and execute the clear command. What does it do? Set TERM back to "vt100" or "ansi" What happens?
    	dumb
    	ansi
    
  5. What happens when you enter the following commands? Why?
    	DATE
    	Date
    	date
    
  6. What results do you get from the command: who -g What program outputs this message?
    
    
  7. How many arguments do each of the following command lines have?
    	echo one    two         threefour
    	echo "My TERM type is " $TERM
    	echo one.two.three
    
  8. What is the difference in output between the following two commands?
    	$ echo red 'white
    	> and blue'
    and
    	$ echo red white \
    	> and blue
    Note: the [enter] key is pressed immediately after the last character
    of each line.
    
  9. Use the shell metacharacter ";" to write out a one line command that will clear the screen, print out the date and the current month's calendar.
    	$ ________________________________________
    

    Commands

  10. If you have not already done so, use the passwd command to change your password. Name three things you should never do with your password:
    	1.____________________
    	2.____________________
    	3.____________________
    
  11. Using the uname command what options would you use to display just the operating system, it's release numbers and the machine's network node name?
    
    
  12. What is the difference in output between the following two commands:
    	banner I am fine
    	banner "I am fine" 
    
  13. Use the finger command to find out what guest90's plan is.
    (Use guest90 as an argument to the finger command.)
    	guest90's plan:
    
    
    
  14. What is your user id number?
    
    

    Using online documentation

  15. Issue a man bc command. Use q to quit.
  16. What is the whatis command? Use the command with the argument, bc
    How does this compare to using the man command with -f option?
    	man -f bc
    
  17. Is tryme a UNIX command? How do you know?
    
    
  18. Use the manual pages and the who command to find out the number of users logged on.
  19. Run the command: man -k boot Use the manual pages to find out what the -k option does. What command is man -k equivalent to? Run the equivalent command and verify.
  20. Run the command: info bash See if you can explore the hot links (marked with a *). Use the up and down arrows to select a link. Use Enter key to follow a link. Use L to go back to last page. Use Q to quit.
  21. Now use your PC browser (outside of Opus) and google "linux bc command". If you find any interesting sites you can post them to the forum.
  22. Here's a challenging task: Use the man command to discover how you can use the bc command to obtain the square root of 361. The bc command is an example of an interactive command, because you must enter the numbers to calculate from the keyboard while the program is running.
    
    

Now that you have finished this lab, you may submit your work using the following two commands:
history -a
submit

When the command asks you which assignment to submit, respond with 2 followed by the enter key. Then answer the three questions that it asks of you.