710 likes | 862 Views
CIS 90 - Lesson 3. Lesson Module Status Slides - draft Flash cards – started properties – page numbers - No-stress quiz – done Web Calendar summary – done Web book pages - none Commands – done Welcome mailed - Lab – done Historical events mailed -. CIS 90 - Lesson 3. Quiz.
E N D
CIS 90 - Lesson 3 • Lesson Module Status • Slides - draft • Flash cards – started • properties – • page numbers - • No-stress quiz – done • Web Calendar summary – done • Web book pages - none • Commands – done • Welcome mailed - • Lab – done • Historical events mailed -
CIS 90 - Lesson 3 Quiz • Please close your books, turn off your monitor, take out a blank piece of paper and answer the following questions: • How do you show your path? • Name four directories where one can find commands? • What is the command to print the manual page for a command?
CIS 90 - Lesson 3 Electronic Mail
CIS 90 - Lesson 3 Previous material and assignment • Questions on Labs or previous material? • Setting variables (term, ps1) • Inputs to a command • via the command line • from the user • from the OS • How work is divided up between shell and a command • Lab 2 due today • submit as many times as you wish up to midnight
CIS 90 - Lesson 3 Lab 1 Results 7) What command shows the other users that are logged in? who8) What command shows you the name of the computer you are interacting with? xxxxxxxxxxhostname9) On Frodo, what three keys must be pressed locally to use terminal tty2? xxctrl+alt+f210) On Frodo, if you log off one session, do you get logged off all the other sessions? no11) On Frodo, is your command history the same for all login sessions? xxxxxno12) What command logs you off? exit 1) On Opus, what was the prompt string? /home/cis90/guest $ x2) What does the history command do? shows previous commands3) On Opus, what was your uid (user id) number? xxx5034) On Opus, what was the name of the shell program being run? xxbash5) What terminal device did you use to access Opus? xxxxx x/dev/pts/2 (this varies)6) On any of the Frodo virtual terminals, what does the hostname command show? xxxxxxxxxx xfrodo
CIS 90 - Lesson 3 Review
CIS 90 - Lesson 3 What the heck are were we doing in Lab 1? D B C We access the Windows PC via its keyboard and monitor. It is running the Windows OS (the XP version) From the PC we use Putty to access the Opus server, which runs the GNU/Linux OS (Red Hat Enterprise Linux distribution) On the PC we use the VMware Server Console to access the Frodo VM, which runs the GNU/Linux OS (Ubuntu distribution) From Frodo VM, we SSH to access Opus (different session than B) A Opus (a RHEL server)
CIS 90 - Lesson 3 Opus (a RHEL server) Putty to rsimms@opus.cabrillo.edu vs just opus.cabrillo.edu
CIS 90 - Lesson 3 ssh to rsimms@opus.cabrillo.edu vs just opus.cabrillo.edu Opus (a RHEL server)
CIS 90 - Lesson 3 Life of the Shell OS Prompt Parse Search Execute Nap Repeat Shell System Commands Applications Kernel
CIS 90 - Lesson 3 Command Syntax Command Options Arguments Redirection [root@opus ~]# hostname opus.cabrillo.edu [root@opus ~]# hostname -i 127.0.0.1 [root@opus ~]# hostname -s opus
CIS 90 - Lesson 3 Commands are Programs Program (a file on drive) console screen (default) stdout Command line (parsed by shell): Options: … Args: … Loads into RAM A Commands get input from: Command line Keyboard Operating System console keyboard (default) read write 0 1 C Operating System Information available only from the OS. E.g. files, directories, date & time, process info, user info, tty info etc. console screen (default) 2 stdin B Keyboard Additional data command needs from user. E.g. passwords, math expressions, … stderr
CIS 90 - Lesson 3 Example program to process: ls command /dev/pts/1 /home/cis90/simmsben/Poems $ tty /dev/pts/1 /home/cis90/simmsben/Poems $ ls ant Blake nursery Shakespeare twister Yeats /home/cis90/simmsben/Poems $ stdout Options: NA Args: NA ant Blake nursery Shakespeare twister Yeats ls read /dev/pts/1 /dev/pts/1 0 directory contents ant Blake nursery Shakespeare twister Yeats (This file information comes from the kernel) 1 stdin 2 stderr
CIS 90 - Lesson 3 Example program to process: bc command [rsimms@nosmo ~]$ tty /dev/pts/1 [rsimms@nosmo ~]$ bc 2> errors <snipped> 2+2 4 4/0 quit [rsimms@nosmo ~]$ cat errors Runtime error (func=(main), adr=5): Divide by zero /dev/pts/1 stdout Options: NA Args: NA 4 bc /home/rsimms/errors /dev/pts/1 0 1 2 stdin 2+2 4/0 stderr Runtime error (func=(main), adr=5): Divide by zero Note: BC is an interactive command and requires user input via stdin
CIS 90 - Lesson 3 Environment Variables Names and Values Use $ for the “value” of a variable Analogy: Each variable is a named location. The contents of any location is the “value” of that variable. $ echo $LOGNAME simmsben $ echo HOME HOME $ echo $HOME /home/cis90/simmsben $ echo $SHELL /bin/bash $ echo $HOSTNAME opus.cabrillo.edu
CIS 90 - Lesson 3 Variable Names and Values Analogy: knobs and settings HI FAN $ echo FAN FAN $ echo $FAN $ FAN=HI $ echo $FAN HI $ echo "The fan is set to: " $FAN The fan is set to: HI $ FAN=LO $ echo "The fan is set to: " $FAN The fan is set to: LO
CIS 90 - Lesson 2 Passwords Delete john.pot, john.log, john.rec …. ./john shadow
CIS 90 - Lesson 3 Housekeeping
CIS 90 - Lesson 3 • Roll call
CIS 90 - Lesson 1 CIS 90 - Signatures The TBA (3 hours and 10 minutes) portion of the is course is required • Michael George • Daniel Black Student signatures here
CIS 90 - Lesson 1 Student Survey • Joshua Keever • Daniel Black • Jaime Cervantes
CIS 90 - Lesson 3 Lord of the Rings Character Code Names Your code names are now available
CIS 90 - Lesson 3 Graded Work Graded work is copied to your home directories: [rsimms@opus ~]$ ls /home/cis90/tumajan and Hidden letter proposal1 spellk tuma bigfile lab01.graded Miscellaneous proposal2 text.err what_am_i bin Lab2.0 mission proposal3 text.fxd yourlastname empty Lab2.1 Poems small_town timecal [rsimms@opus ~]$
CIS 90 - Lesson 3 Forum Registration • To Register: • Click on Register link • Agree to terms • For your Username to be accepted it must be: • your fullfirst and last name separated by a space e.g. Rich Simms • match a name on the class roster • Daniel Black • Joshua Keever • Craig Langlo • Gabriel Pantoja • Joe Ferrante • Jaime Cervantes
CIS 90 - Lesson 3 Using the Forum • Use email to report typos or anything of a personal nature. • Use the forum for EVERYTHING else. • Usually if I get questions emailed to me that may be of interest to other students I'll ask you to post on the forum instead. • Short, concise one topic posts are best. If you have a list of unrelated questions it is better to separate into single topic posts. • Pick a subject line that summarizes your topic. This makes it easier to search for topics later. • For trouble-shooting questions please include information so others can duplicate the problem you are having. Next week is 1st 5 post deadline
CIS 90 - Lesson 3 Using the Forum Demonstration Demonstrate - formatting, smilies, avatars, search, practice forum, members, etc. Next week is 1st 5 post deadline
CIS 90 - Lesson 3 Extra Credit Link to Extra Credit page is on the Grades page Note the caps on extra credit.
CIS 90 - Lesson 3 Extra Credit Howtos
Internships • Last week we met with local businesses. • Topic: paid and unpaid internships for Cabrillo CIS/CS students. • Cabrillo has resources for writing resumes, interviewing, job etiquette, etc. See: http://cabrillo.edu/services/jobs • Jobs mailing list: Subscribe by emailing (no subject or body): • networkers-subscribe@cabrillo.edu
CIS 90 - Lesson 3 Write Command
CIS 90 - Lesson 3 write command send a message to another user • write username [ttyname] • Use ttyname if there are multiple logins by same username • The receiver gets: • Message from yourname@yourhost on yourtty at hh:mm … • Each line you type gets sent to the other user. • To end sending messages type Ctrl-D (Ctrl and D keys at the same time) • The receiver will see an EOF (end of file) at the end. • If the receiver wants to reply then they need to use write command as well.
CIS 90 - Lesson 3 write command send a message to another user Note, the pts/4 is not needed if there is only one login by the username the message is being sent to Ctrl-D
CIS 90 - Lesson 3 write command Beji chats with Mary using write commands 1 3 5 (a convention, "o" used for over) 8 10 simmsben 12 13 15 Use Ctrl-D to stop writing. Ctrl-D is EOF (End of File) and is slightly more friendly than Ctrl-C 17 18 (Ctrl-D) 21 19 2 4 6 7 9 11 14 16 (Ctrl-D) 17 20 simmsmar 22
CIS 90 - Lesson 3 mesg command enable or disable writes to your terminal Use n to disable or y to enable simmsmar simmsben
CIS 90 - Lesson 3 Class Exercise write and mesg • Logon to Opus • Type ls /home/cis90 to see all student usernames • Introduce yourself to the other students at your table and do a back and forth test using the write command. • Use mesg command to enable and disable. • Start collecting each other's usernames to use for Lab 3
CIS 90 - Lesson 3 Mail Command
CIS 90 - Lesson 3 UNIX mail Sending messages Benji sends an email to Rich and Mary Intended recipients simmsben The first prompt is "Subject: ", you enter the subject, then enter the message. The last prompt is "Cc: ". After hitting Enter the message is sent Use . or Ctrl-D to end the message simmsmar richsimms@yahoo.com Tip: cc yourself to save a copy of messages sent
CIS 90 - Lesson 3 UNIX Mail Reading messages Mary reads email from Benji One message is in the header list (in tray), "N" means New, "1" is the message number simmsmar The & is the mail prompt. Enter a 1 to read message 1
CIS 90 - Lesson 3 UNIX mail Reading messages sent from UNIX mail Rich reads email from Benji richsimms@yahoo.com
CIS 90 - Lesson 3 UNIX Mail Replying to messages Mary replies to email from Benji simmsmar Enter an r to "reply to all" for the last message read
CIS 90 - Lesson 3 UNIX Mail Benji gets the reply from Mary simmsben Benji reads reply from Mary Entering just the message number or a "p" followed by the message number are equivalent. The p is the mail print command.
CIS 90 - Lesson 3 UNIX Mail Rich reads reply from Mary richsimms@yahoo.com
CIS 90 - Lesson 3 Class Exercise UNIX mail • Logon to Opus • Work with the other students at your table • Send an email to one other student • Send an email to all students at your table and cc: yourself • Reply to the messages you receive • Start collecting each other's student usernames to use in Lab 3
CIS 90 - Lesson 3 More on Mail Command
CIS 90 - Lesson 3 mail command read and write modes • Read mode: • mail (to read new messages) • mail –f (to read saved messages in mbox) • mail –f myfile (to read saved messages in myfile) • Write mode: • mail simmsben • mail simmsben simmsmar richsimms@yahoo.com
CIS 90 - Lesson 3 mail command read mode sub commands • You are in read mode when you invoke mail with no arguments • ? print these commands • p <message list> print messages • n goto and print next message • e <message list> edit messages • d <message list> delete messages • s <message list> file save (append) messages to file • u <message list> undelete messages • R <message list> reply to sender(s) • r <message list> reply to all • m <user list> mail to specific users • q quit, saving read messages to local mbox file • x quit, mark all mail as unread and undeleted. • h print out active message headers • A <message list> consists of integers, ranges of same, or user names separated • by spaces. If omitted, Mail uses the current message • A <user list> consists of user names separated by spaces.
CIS 90 - Lesson 3 mail command (h)header sub-command h (print headers – e.g. list my in tray) message numbers N = New, message is unread > points to the current message (last one printed)
CIS 90 - Lesson 3 mail command (p)rint sub-command print all messages from simmsmar
CIS 90 - Lesson 3 mail command (p)rint sub-command print message 5, note that commands can be abbreviated to a single letter
CIS 90 - Lesson 3 mail command (p)rint sub-command print messages 4 -5