Cis52
Download
1 / 29

week3 - PowerPoint PPT Presentation


  • 335 Views
  • Updated On :

CIS52 Week 3 Agenda User Communication System V Manual Sorting Searching File Compression Miscellaneous Utilities User Communication write talk mesg mail biff finger write sends a message to another logged on user syntax: write destination-user [terminal]

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'week3' - albert


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Cis52 l.jpg

CIS52

Week 3


Agenda l.jpg
Agenda

  • User Communication

  • System V Manual

  • Sorting

  • Searching

  • File Compression

  • Miscellaneous Utilities


User communication l.jpg
User Communication

  • write

  • talk

  • mesg

  • mail

  • biff

  • finger


Write l.jpg
write

  • sends a message to another logged on user

  • syntax: write destination-user [terminal]

    one or more lines of text

    ^d

  • example: write n01

    Having a bad Unix day?

    ^d


Slide5 l.jpg
mesg

  • allows write and talk to send messages to you (or not)

  • example: mesg n

    mesg y


Slide6 l.jpg
mail

  • Modeled after typical postal system

  • Unix post office has file for each user

    • /usr/spool/mail/n01

  • each user also has a personnel mailbox called mbox. (created in users home directory)

  • when you read mail, it is moved to your postbox.


Slide7 l.jpg
mail

  • Mail consists of

    • heading and body

  • heading

    • to

    • subject

    • cc

    • bcc

  • body is your message.


Slide8 l.jpg
mail

  • Two modes: compose and command

  • type mail at shell prompt to enter command mode.

  • type mail user-id to enter compose mode

    end compose mode with ^d (type a period in linux)

    ~ allows you to shell out to another command

    • ~v

    • ~r myfile


Mail command options l.jpg
Mail command options

  • q leave mail

  • r reply to originator

  • R reply to everyone on distribution list

  • d delete current message

  • ! Shell out (ie, !date)

  • ? Help

  • h display list of message headers


Slide10 l.jpg
biff

  • Toggle switch to alert you when mail has been sent

  • biff y

  • biff n

  • BSD utility .. Not on many systems


Slide11 l.jpg
talk

  • two way conversation with split screen visable for both

  • example: talk n01

  • lines of message

  • ^d

    (on some systems, the del key)


Finger l.jpg
finger

  • displays info about a user

  • login id, name, tty, idle time, log in status

  • example: finger n01

  • Will also display contents of a .plan file (if in the targets home directory


Man pages l.jpg
Man Pages

  • 8 Sections

  • At least 3 parts to each page

    • name and purpose

    • synopsis (command usage, arguments)

    • description

  • Optional

    • diagnostics, bugs, examples


Man pages14 l.jpg
Man Pages

  • Development of the man pages

    • nroff utility for low resolution devices

      • terminals

      • dot matrix printers

      • line printers

    • troff utility for high resolution devices

      • lasers and phototypsetters


System v manual sections l.jpg
System V Manual Sections

  • 1. Commands and application programs

  • 2. System Calls

  • 3. Library Functions

    • (BSD .. Special files, drivers)

  • 4. File Formats

    • (BSD .. File formats, sys admin)


System v manual sections16 l.jpg
System V Manual Sections

  • 5. Miscellaneous

  • 6. Games

  • 7. Special Files

    • (BSD .. Miscellaneous)

  • 8. System Maintenance


Sorting l.jpg
Sorting

  • Options

    • f upper and lower case considered the same

    • r reverse order (ie, z to a)

    • u duplicate entries are eliminated from output

    • k defines the field to start the sort comparisons. Count starts with 1 (replace k with a number)

    • b ignores blanks


What is a field l.jpg
What is a ‘field’

  • Contains ascii data

  • delimited by ‘whitespace’

  • whitespace is:

    • tab

    • blank

    • carriage return

  • example

  • the day the earth stood still



Sorting20 l.jpg
Sorting

  • Examples

    • sort myfile

    • sort -r myfile

    • sort file1 file2

    • sort file1 file2 > file3

    • sort +1 myfile

      • (skip a field, then start comparisons)


Sorting21 l.jpg
Sorting

  • sort +1 -2 myfile

    • skip a field (start sort in field number 2)

    • end sort at end of field 2

  • sort -b +2.1 -3

    • -b ignore blanks

    • +2 skips first two fields

    • .1 skip 1 character in next field

    • 3 ends sort key at end of field 3


Searching with grep l.jpg
Searching with grep

  • searches standard in for a pattern

  • sends all lines with that pattern to std out

  • options

    • -v ignore lines which do NOT have pattern

    • -i ignore case

    • -c count lines

    • -n print line numbers

    • -l print file names only


Slide23 l.jpg
grep

  • Examples

    • grep aardvark animalfile

    • grep -v aardvark myfile

    • grep -vi minnie myfile

    • who | grep minnie

    • grep * data

    • grep -l ‘[D,d]ata’ *


File compression l.jpg
File Compression

  • compress

    • examines file, searches for repeated patterns

    • recodes file and renames with .Z

  • uncompress

    • restores compressed file to original form

    • removes .Z

  • zcat

    • sends content of compressed file to std out.


Compression l.jpg
compression

  • Compress -v myfile

    • myfile.Z (v prints name of file % % compression)

  • cat myfile.Z

  • zcat myfile.Z

  • uncompress myfile.Z


Miscellaneous utilities l.jpg
Miscellaneous Utilities

  • File displays type of file

    • file file1.Z

  • diff displays difference between two files

    • diff myfile yourfile

  • uniq displays unique lines

    • assumes file is sorted

    • uniq myfile


Tr translate l.jpg
tr (translate)

  • tr is a filter and does not allow filename to be entered as an argument

  • tr must get its data from std in

    • either from <file or from a pipe

  • tr a A <myfile

  • who | tr a A

  • who | tr abc ABC

  • who | tr ‘[a-z] [A-Z]’


Feedback l.jpg
Feedback

What do the following commands do?

  • mail minnie < temp

  • who | mail minnie

  • compress myfile | mail minnie

  • mesg n

  • sort -r myfile

  • sort +3 myfile


Feedback29 l.jpg
Feedback

  • grep -v clinton

  • grep abc* temp

  • grep unix lab[1-6]

  • tr a B myfile

  • who | ls

  • who > wc -l

  • woof y