Name_______________________________

Lab02: Using Commands


Objectives

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

Procedure

     Log on to the Opus server using your personal account obtained from submitting
     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 

    The Shell

  1. What shell are you currently using? What command did you use to determine this?
    bash, as shown using the ps command
    
  2. Use the following commands as arguments to the type command, and write down where each of the commands reside.
    	argument	location
    	  man		/usr/bin
    	  uname		/bin
    	  tryme		/$HOME/bin
    	  echo		shell builtin
    	  type		shell builtin
    
  3. Use the echo command to find the values of each of the following shell variables. Write them down next to the variable name.
    	HOME		/home/CIS190/your-home-directory
    	TERM		xterm or linux
    	LOGNAME		your login name
    	PS1		$PWD $ 
    	SHELL		/bin/bash
    	PATH	/usr/local/bin:/bin:/usr/bin:/home/CIS90/$LOGNAME/bin:.
    
  4. Set the TERM environment variable to "dumb", and execute the clear command. What does it do? Set TERM back to "ansi" What happens?
    	dumb		screen doesn't clear.
    	ansi		screen clears, prompt goes to top of screen.
    
  5. What happens when you enter the following commands? Why?
    	DATE		DATE: not found
    	Date		Date: not found
    	date		Unix is case sensitive
    
  6. What results do you get from the command: who -g What program outputs this message?
    	the who commands outputs a usage message
    
  7. How many arguments do each of the following command lines have?
    	echo one    two         threefour	three
    	echo "My TERM type is " $TERM		two
    	echo one.two.three			one
    
  8. What is the difference in output between the following two commands?
    	$ echo red 'white
    	> and blue'		output takes up two lines
    and
    	$ echo red white \ 
    	> and blue		output is all on one line
    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, displays the date and the current month's calendar.
    	$ clear; date; cal 

    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.__Forget it
    	2.__Give it to someone else
    	3.__Write it down in an easy-to-find location
  11. Using the uname command what options would you use to display the operating system, it's version and release numbers?
    
    	$ uname -ovr
    
  12. What is the difference in output between the following two commands:
    	banner I am fine		three lines of output
    	banner "I am fine" 		one line of output
    
  13. Use the finger command to find out what guest's plan is. Use guest90 as an argument to the finger command.
    	guest's plan:To pass this course with flying colors!
    
    
    
  14. What is your user id number? between 1100 and 1131

    Using man

  15. Is tryme a Unix command? How do you know?
    	It's a command, but not a UNIX command.
    
  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
    	They are the same.
    
  17. Use the manual pages for the who command to find out when the system was last booted.
    who -b
  18. 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?
    	It is equivalent to the command apropos.  It searches for keywords
    in the descriptions of all the commands.
    
  19. 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.
    sqrt(361) returns the result: 19