Input/Output Redirection Flashcards
How do you use output redirection to append to a file?
> >
i.e ls»_space; file
How do you use output redirection to overwrite a file?
>
i.e ls > file
How do you use output redirection to redirect only stdout?
1>
1»
How do you use output redirection to redirect only stderr?
2>
2»
How do you use input redirection to redirect to a command?
<
i.e head < file
How do you use output redirection to redirect stderr and stdout?
&>
&»
How do you redirect stderr to stdout?
2>&1
*useful if piping as they only accept stdout
How does piping work?
Allows to take stdout and provide it to another command
i.e cat file | wc
What location can be redirected to if the output is not needed?
/dev/null
*empty character device containing nothing