This page was generated from 01.intro.mth.

This page is part of the course work for CS360: Systems Tools course offered by the Computer Science Department at CalState, San Bernardino, California, USA. It was generated by Dr. Dick Botting.

Contents


    Introduction to CS360 and UNIX Tools

      Why

    1. This class will help you do work for other classes.
    2. This class will help you solve problems as part of your job.
    3. This class is part of of the CS Certificate program.
    4. It is fun.
    5. Even if you decide that the world is an WinDOS world anyway you may need to show that you are not basing your conclusion on ignorance.
    6. The feeling of power.

      Something not covered

      We won't be covering networking in CS360 because this covered in CS124 and the other classes in the certificate(CS365+CS366).

      Using a Remote Machine

      If you are already familiar with logging into a remote machine and letting it control your DISPLAY please see [ #Reading ] below.


      (rlogin):


        (1) take note of the name of your local machine or display:
         	echo $DISPLAY
        This may produce output like this:
         		local_machine:0.window
        or
         		local_machine:0
        If not, look in your command line prompt or try the following command
         		hostname
        (2) give the remote machine permission to use your display:
        	xhost remote_machine
        (3) Remotely login to the remote machine
        	rlogin remote_machine -l your_user_name
        or the more secure version:
        	slogin remote_machine -l your_user_name
        (4) On the remote machine... tell it your display
        	DISPLAY=local_machine:0; export DISPLAY

      Reading

      Here are some notes on the first chapter of the text book: R'Reilly "Power Tools".

      O'Reilly 1.01, 1.02 is essential reading.

      UNIX is designed for power users, not novices. Their are lots of small but powerful programs that can be easily connected up to solve complex problems [ O'Reilly 1.03..1.07]

      You are probably using a shell called the Bourne Again SHell or bash. It aims to have all the features of the C shell, the Bourne shell (sh)(by Steve Bourne) and the Korn shell created by David Korn( ksh). bash combines the best features of the shells in the book. [ O'Reilly 1.08..1.09]. For more on the Korn Shell see [ http://www.kornshell.com/~dgk/ ] (Thanks to Heiner Steven heiner.steven@odn.de for correcting these notes).

      All our workstations and almost all the servers at CSci.CSUSB.EDU share the same accounts. The account information is served by the NIS or YP(Yellow pages) servers. So use 'ypcat passwd' not 'cat /etc/passwd'.

      The passwd file is public knowledge because (1) passwords are encrypted, and (2) we chose our passwords so that they can not be guessed, and (3) we change them often enough that by the time some one has cracked one, we've changed it anyway.

      You can see your PATH by inputting the internal command

       		echo $PATH
      [O'Reilly 1.10].

      When you type an external command, your shell goes to sleep while UNIX executes a command and wakes up when it is finished[O'Reilly 1.10, 1.13].

      All programs can be commands. Most commands are the name of a program. The shells are programs that read commands. Therefore you can enter another shell by typing its name as a command, and your old shell waits until you've finished sending commands to the new shell.

      Scripts are files that can be read and executed by shells or other programs[O'Reilly 1.12].

      UNIX systems are always busily running dozens of processes -- and you don't know about most of them.


      (kernel): The kernel is the heart of UNIX.[1.14] The kernel hides the hardware from the user[1.14]. The kernel protects the user from knowing the bits, bytes, and SCSI little details[1.14]. It also protects data from unwanted intrusions.[1.23] Programs can't "get around" the kernel. Most of the time you forget that the kernel exists.


      (case): UNIX is CaSe SeNsItIvE.[1.15]


      (rm): Once a file is removed its storage is instantly recycled for someone else to use. It is often scrambled for security reasons as well. Hence a removed a file is gone forever.[1.15]

      Some characters have a special meaning to a UNIX shell and are removed or replaced before a command is executed by the shell. [1.16]


        Shell wild cards: ?, *, [...] [1.16] [ Syntax ]

        Shell punctuators: ; & && | || () [] {} and newline. [ Syntax ]


      Extensions are just suffices that some programs think are special[1.17]

      UNIX file systems are a directed graph, not just a tree. However there is a single top level directory from which all others are found - the root "/"[1.19].

      A disk drive can be anywhere on the network.... so you do not refer to disk drives when you want to name a file.

      Directories are files that describe where other files can be found. A path follows from directory to directory.

      When you login you are working "in" your "home directory". At any time you have a current working directory or CWD

      The kernel hides the physical structure of the file system (Inodes)[1.22]

      The kernel hides the data in some files and directories from some users[1.23,1.25], but the superuser can see anything every where[1.24]. Hence only one or two people should ever have access to the superuser account.

      Lots of people use a UNIX machine at one time... even when they are not logged in[1.26,1.27]

      We have the abillity to run programs in the background[1.27]. Look out for the gotchas[1.28].

      UNIX makes everything look like a file[1.29]. Your terminal looks like a pair of files as well! You can redirect output(>) from your terminal to a file, or redirect input(<) so that it is taken from a file rather than your terminal[1.30].

      We run XWindows[1.31].

        By the way:
      • The first UNIX window system was called W. So the next is X.

      We are on the Internet and we have mail, ftp, uucp, usenet, rlogin. rcp, rsh, NFS, write, talk, ...[1.33]

      UNIX is not perfect[1.34]. You have my permission to "let of steam" (but politely) on the BBS. There are things in UNIX that still drive me wild... but I keep my flames clean! I also accept that your feelings may not match mine.

      You learn UNIX by doing as well as by reading. See the Exercises.

      Syntax

    7. file_name::=any sequence of letters, digits, underscores, +. -, :, ., #,....

    8. directory_name::=file_name. A directory is a specially formatted file in UNIX so the sames names are used for directories and files.

    9. pathname::= relative_path_name | absolute_path_name.

    10. relative_path_name::=directory_name "/" directory_name "/" ... "/" filename. [ relative_path ]

    11. absolute_path_name::="/" relative_path_name | "~" "/" relative_path_name.

    12. shell_wild_card::="*" | "?" | "[" characters "]".

    13. punctuation::= ";" | "&" | "|" | "&&" | "||" | parentheses | brackets | braces | quotation_marks.

      Definitions

    14. shell::=a program that reads commands and interprets them by calling other programs and the kernel.

    15. path::=a pathname describes a way to find a file or directory as a sequence of directory names.

    16. program::=a complex collection of commands that can be executed by a machine or by another program.

    17. CWD::=current working directory.

    18. relative_path::=The CWD is prefixed in front of relative paths.

      For all relative_path_name P, ./P means the same thing as P.

      Exercises

      Type in the following carefully and see what they do (CTRL/D means hold down the CTRL key and tap the D key):
      	cal 1996
      	cal
      	cal >month
      	cat month
      	date
      	who
      	finger
      	cat >mine
      	Pack my box with five dozen liquor jugs!
      	CTRL/D
      	cat m????
      	cat >a2A
      	tr 'a' 'A'
      	CTRL/D
      	chmod +x a2A
      	a2A <mine
      	a2A <month
      	sed "s/ my / your /" <mine >yours
      	cat yours

      See also

      The CS FAQ booklet [ CS_FAQ.html ]

      Study the syllabus, schedule and other information forthis class: [ syllabus.html ] [ syllabus.html ] and [ schedule.html ] [ schedule.html ]

      Browse through the WWW pages for this class. Login to your favorite machine in the CS dept and use mosaic, netscape, or lynx(which ever works and you like) to look at http://www/dick/cs360. From a non-CS lab, the IBM PC Lab, AOL, or another ISP point their WWW server at http://www.csci.csusb.edu/cs360

      O'Reilly: chapter 1, p39(intro to part one)

      Questions

      Once your command procedure (proc) has been made, How do you run it?
      1. First 'chmod +x proc', then 'proc' ?
      2. just type in 'proc' ?
      3. just type in 'sh proc' ?
      4. both 1 and 3 ?
      5. both 2 and 3 ?

      Inode is short for
      1. illicit node ?
      2. inspecting node ?
      3. incorrect node ?
      4. none of the above ?

      What is the * considered to be?
      1. a variable ?
      2. a Wildcard ?
      3. a dead bug ?
      4. a question ?
      5. a wildcard and a dead bug. ?

      In the command 'cat m???' the shell
      1. finds the matching file names ?
      2. makes a list of them ?
      3. calls the cat command ?
      4. all of the above in sequence ?
      5. does none of these things... the kernel does them. ?
      6. does none of these things... 'cat' does them. ?

      In a command like
      		grep '[Ww]hich' chapter1 |more
      the command 'more':
      1. searches the file chapter1 for strings ?
      2. lets you see the output one screenful at a time ?
      3. is not executed because "|" indicates a comment ?
      4. in error since more is not a UNIX command. ?

      What does the following command do:
       		cat files|grep .XX|sort -u|more

      1. search for matching lines and sort them ?
      2. search for matching lines and sort them discarding duplicates ?
      3. search for duplicates lines ?
      4. search for duplicate lines and mark them with XX ?

      The UNIX shells have ______ looping construct(s)
      1. no ?
      2. one ?
      3. some ?
      4. nothing but ?


         Who is the Bourne $shell user below:
      1. yasha::123:10:Yasha Karant:/usr/yasha:/bin/csh ?
      2. tasha::124:10:Tasha Ya:/usr/tasha:/bin/tcsh ?
      3. arash::126:10:Arash Khorashad:/usr/arash:/bin/sh ?
      4. bash::125:10:Bashir Kassab:/usr/bash:/bin/bash ?

      Consider the following:
       		star.trek.z

      1. This is not a valid UNIX file name ?
      2. This is a valid name for some kind of file ?
      3. This is a valid name for a packed file ?
      4. This is the shell of the famous trek game. ?

      As far as UNIX is concerned just about all hardware devices behave as if they were:
      1. Objects ?
      2. Programs ?
      3. Shells ?
      4. Files ?

      Next

      Logging in [ 02.login.html ] [ 02.login.html ] , logging out [ 03.logout.html ] [ 03.logout.html ] , and simple security [ passwords.html ] [ passwords.html ]

    . . . . . . . . . ( end of section Introduction to CS360 and UNIX Tools) <<Contents | End>>

    Submit Your Notes Here

    To earn credit for completing this part of the course you need to send me a short list of things you have learned. A simple way to do this is to follow this [click here [socket symbol] if you can fill this hole] link and fill in the form using copy and paste.

End