1 / 12

Redirection & Pipes

Redirection & Pipes. Understanding UNIX Input and Output. What is Input?. Information fed into a data processing system or computer (Merriam-Webster Dictionary) Data necessary to create some action or output. Text ‘Hello World’ Keystroke combinations CTRL -D. Input Sources.

Download Presentation

Redirection & Pipes

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Redirection & Pipes Understanding UNIX Input and Output

  2. What is Input? • Information fed into a data processing system or computer (Merriam-Webster Dictionary) • Data necessary to create some action or output. • Text • ‘Hello World’ • Keystroke combinations • CTRL -D

  3. Input Sources • Standard Input (stdin) Device • That part of the operating system controlling from where a program receives its input. • keyboard • Any defined device capable of receiving input

  4. What is Output? • The information produced by a computer (Merriam-Webster Dictionary) • Data created as a result of some action or input. • Text • ‘Hello World’ • Pictures & Graphics • …

  5. Output Destinations • Standard Output (stdout) Devices • That part of the operating system that controls where a program writes its output. • Monitor • Printer • Any defined device capable of receiving output

  6. What is a file? • UNIX is a file based operating system • Everything is a file • Say What!?

  7. UNIX File Types • Types of files • Directory File • Contains references to other files • /dev • Regular File • Text, configuration, etc. • /home/my.txt • Device Files • /dev/cdrom

  8. UNIX Commands • Are commands Files too • Typically single “specialized” functions • Commands are files that accept input and perform some operation, either • On the input directly, or • # cat my.txt • As directed by the input. • # ls –al /usr

  9. Redirection • Where? • > the redirection operator • Allows for an output destination other then standard output (stdout). • Is a write only operation • Can only redirect to regular files. • # ls –al /usr > directory.lst

  10. Pipes • Keeping the Flow Going… • | the pipe operator • Allows for the output (stdout) of one command to serve as the input (stdin) of another command • No write involved in the process • Can only be used with commands (executables) • # ls –al /usr/bin | grep ls -

  11. Putting it All Together • What do we gain • Extended functionality • Increased control • Innovative solutions • An understanding of both input and output

  12. IN CLASS DEMONSTRATION • SIX Volunteers able to follow instructions • Hmmmm… • A paper | B | C | D | E | F > Frontdesk

More Related