Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux_wiki:use_input-output_redirection [2016/02/28 22:48] billdozor created |
linux_wiki:use_input-output_redirection [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 7: | Line 7: | ||
---- | ---- | ||
- | **> Redirect standard output to a file, overwrite contents** | + | '>' |
<code bash> | <code bash> | ||
cat / | cat / | ||
</ | </ | ||
- | **>> Redirect standard output to file, append to file** | + | \\ |
+ | '>>' | ||
<code bash> | <code bash> | ||
tail /etc/passwd >> info.txt | tail /etc/passwd >> info.txt | ||
</ | </ | ||
- | **| Piping output to other commands** | + | \\ |
+ | '|' | ||
<code bash> | <code bash> | ||
cat /etc/passwd | wc -l | cat /etc/passwd | wc -l | ||
</ | </ | ||
- | Count the number of lines in /etc/passwd | + | * Counts |
- | **2> Redirect standard error** | + | \\ |
+ | '2>' | ||
<code bash> | <code bash> | ||
ssh admin@webserver01.com " | ssh admin@webserver01.com " | ||
</ | </ | ||
- | SSH to webserver01.com, | + | * SSH to webserver01.com, |
- | **Redirect both standard error and standard output** | + | \\ |
+ | Redirect both standard error and standard output | ||
<code bash> | <code bash> | ||
ssh admin@webserver01.com " | ssh admin@webserver01.com " | ||
</ | </ | ||
- | **Redirect standard error to standard out** | + | \\ |
+ | Redirect standard error to standard out | ||
<code bash> | <code bash> | ||
cat / | cat / | ||
</ | </ | ||
- | Standard output can be passed through a pipe to the next command. By redirecting standard error to standard output, any error messages are successfully sent through as well. | + | * Standard output can be passed through a pipe to the next command. By redirecting standard error to standard output, any error messages are successfully sent through as well. |
---- | ---- | ||