Basic Linux Tutorial
Computer Tutorial

Redirection & Piping



Redirection & Piping

Symbol Function Syntax
> Redirect stdout and overwrite or create a file prog > file
< Redirect stdin prog < file
>> Redirect stdout and append to, or create a file prog >> file
2> Redirect stderr prog 2> file
2>&1 Send stderr and stdout to the same file prog 2>&1 file
| Pipe stdout of prog1 to stdin of prog2 prog1 | prog2
|& Pipe stdout and stderr of prog1 to stdin of prog2 prog1 |& prog2