Pipelines: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "Philosophy of the commandline: Small tools that do one thing very well, loosely connected together to make custom "pipelines" or workflows to do specific (or surprising) thing...")
 
Line 5: Line 5:
Every program receives "standard in", and sends its output to "standard out". By default, stdin is taken from the keyboard, and stdout will display something to the screen. These mappings can be adjusted however using ''redirection'' using the special pipeline characters '>', '<', and '|'.
Every program receives "standard in", and sends its output to "standard out". By default, stdin is taken from the keyboard, and stdout will display something to the screen. These mappings can be adjusted however using ''redirection'' using the special pipeline characters '>', '<', and '|'.


== Redirection: > ==


... > savetofilename.blah
== Redirecting ''stdout'' with > ==


Take stdout and "saves as..." a filename
date
 
Displays the date to the screen (no stdin used by date).
 
date > time.txt
 
Redirects the output of date and "saves as" time.txt.
 
cat time.txt
 
Display time.txt (to the screen by default)
 
== Redirecting ''stdin'' with < ==
 
== Piping (stdin=>stdout) with | ==

Revision as of 10:55, 20 February 2013

Philosophy of the commandline: Small tools that do one thing very well, loosely connected together to make custom "pipelines" or workflows to do specific (or surprising) things.

stdin and stdout

Every program receives "standard in", and sends its output to "standard out". By default, stdin is taken from the keyboard, and stdout will display something to the screen. These mappings can be adjusted however using redirection using the special pipeline characters '>', '<', and '|'.


Redirecting stdout with >

date

Displays the date to the screen (no stdin used by date).

date > time.txt

Redirects the output of date and "saves as" time.txt.

cat time.txt

Display time.txt (to the screen by default)

Redirecting stdin with <

Piping (stdin=>stdout) with |