|}
For example, <syntaxhighlight {{code|lang="bash" inline>command1|1=command 2> file1</syntaxhighlight>}} executes {{mono|command1command}}, directing the [[Standard streams#Standard error (stderr)|standard error]] stream to {{mono|file1}}.
In shells derived from [[C shell|csh]] (the [[C shell]]), the syntax instead appends the {{mono|&}} (ampersand) character to the redirect characters, thus achieving a similar result. The reason for this is to distinguish between a file named '1' and stdout, i.e. <syntaxhighlight {{code|lang="bash" inline>|1=cat file 2>1</syntaxhighlight>}} vs <syntaxhighlight {{code|lang="bash" inline>|1=cat file 2>&1</syntaxhighlight>}}. In the first case, stderr is redirected to a file named '{{mono|1}}' and in the second, stderr is redirected to stdout.
Another useful capability is to redirect one standard file handle to another. The most popular variation is to merge [[Standard streams#Standard error (stderr)|standard error]] into [[Standard streams#Standard output (stdout)|standard output]] so error messages can be processed together with (or alternately to) the usual output. For example, <syntaxhighlight {{code|lang="bash" inline>|1=find / -name .profile > results 2>&1</syntaxhighlight>}} will try to find all files named {{mono|.profile}}. Executed without redirection, it will output hits to [[stdout]] and errors (e.g. for lack of privilege to traverse protected directories) to [[stderr]]. If standard output is directed to file {{mono|results}}, error messages appear on the console. To see both hits and error messages in file {{mono|results}}, merge [[stderr]] (handle 2) into [[stdout]] (handle 1) using {{code|2>&1}}.
If the merged output is to be piped into another program, the file merge sequence {{code|2>&1}} must precede the pipe symbol, thus, <syntaxhighlight {{code|lang="bash" inline>|1=find / -name .profile 2>&1 | less</syntaxhighlight>}}
A simplified but non-POSIX conforming form of the command, <syntaxhighlight {{code|lang="bash" inline>|1=command > file 2>&1</syntaxhighlight>}} is (not available in Bourne Shell prior to version 4, final release, or in the standard shell [[Debian Almquist shell]] used in Debian/Ubuntu): <syntaxhighlight {{code|lang="bash" inline>|1=command &>file</syntaxhighlight>}} or <syntaxhighlight {{code|lang="bash" inline>|1=command >&file</syntaxhighlight>}}.
It is possible to use <code>2>&1</code> before "<code>></code>" but the result is commonly misunderstood.
Then "<code>></code>" redirects handle <code>1</code> to something else, e.g. a file, but it does '''not''' change handle <code>2</code>, which still points to ''stdout''.
In the following example, standard output is written to ''file'', but errors are redirected from stderr to stdout, i.e. sent to the screen: <syntaxhighlight {{code|lang="bash" inline>|1=command 2>&1 > file</syntaxhighlight>}}.
To write both errors and standard output to ''file'', the order should be reversed. Standard output would first be redirected to the file, then stderr would additionally be redirected to the stdout handle that has already been changed to point at the file: <syntaxhighlight {{code|lang="bash" inline>|1=command > file 2>&1</syntaxhighlight>}}.
==Chained pipelines==
|