Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (20 sloc) 717 Bytes
# Send contents of file to command
$ command < file
# Redirect to file and pipe
$ command > file | grep -i error
# Redirect Stderr twice
$ command 2> file2 > file1 2>&1
# Text to Stdin (command)
$ command << 'text'
# Redirect both Stdout and Stderr to file
$ command > file 2>&1
# Redirect Stdout to one file and Stderr to another
$ command > file1 2> file2
# Pipe Stdout and Stdin to another process
$ command 2>&1 | command2
$ less <(gzip -cd foo.gz)
$ gzip -cd foo.gz && less foo
# Redirect an error
$ echo An Error >&2 2>&1 | sed -e 's/A/I/'
# Redirect both stdout and stderr
$ foo &> foo.log