AU Study/TAFE

command line inputoutput codecademy

Last72 2017. 9. 25. 13:09

Redirection reroutes standard input, standard output, and standard error.

 

The common redirection commands are:

 

 

 

> redirects standard output of a command to a file, overwriting previous content.

 

>> redirects standard output of a command to a file, appending new content to old content.

 

< redirects standard input to a command.

 

| redirects standard output of a command to another command.

 

A number of other commands are powerful when combined with redirection commands:

 

 

 

sort: sorts lines of text alphabetically.

 

uniq: filters duplicate, adjacent lines of text.

 

grep: searches for a text pattern and outputs it.

 

sed : searches for a text pattern, modifies it, and outputs it.