click below
click below
Normal Size Small Size show me how
LPI101 - table 5-4
Standard I/O redirections
| Question | Answer |
|---|---|
| Send stdout to file. | $ cmd > file $ cmd 1> file |
| Send stderr to file. | $ cmd 2> file |
| Send both stdout and stderr to file. | $ cmd > file 2>&1 |
| Send stdout to file1 and stderr to file2. | $ cmd > file1 2> file2 |
| Receive stdin from file. | $ cmd < file |
| Append stdout to file. | $ cmd >> file$ cmd 1>> file |
| Append stderr to file. | $ cmd 2>> file |
| Append both stdout and stderr to file. | $ cmd >> file 2>&1 |
| Pipe stdout from cmd1 to cmd2. | $ cmd1 | cmd2 |
| Pipe stdout and stderr from cmd1 to cmd2. | $ cmd1 2>&1 | cmd2 |