Type echo <(true) in Bash and it prints /dev/fd/63. That short path is the whole idea of process substitution. Bash starts a command in the background, connects its output to a file descriptor, and hands the next program a filename that points at it. Programs that only accept filenames, such as diff, comm or paste, can then read the output of other commands directly, with no temporary files to create or clean up. Tests in GNU Bash 5.2.21 show what it is good for, what it hides and where it does not work at all.
What the shell actually does
A filename for a running command
The Bash manual’s section on process substitution says the feature “allows a process’s input or output to be referred to using a filename.” There are two forms. <(list) runs list and gives a filename that, when read, yields its output. >(list) gives a filename that, when written to, feeds list‘s input.
The manual adds that “The process list is run asynchronously, and its input or output appears as a filename.” In the test, echo <(true) >(true) printed /dev/fd/63 /dev/fd/62: two file descriptor paths, one for each substitution.
Syntax that has to be exact
The manual warns that there must be no space between the < or > and the opening parenthesis. < (sort a.txt) is a redirection followed by a subshell, a different thing entirely. And the feature “is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files,” which covers Linux and macOS but rules out some minimal environments.

Comparing outputs without temp files
diff two commands
The classic use is comparing the processed output of two commands. With a.txt holding pear, apple and fig, and b.txt holding fig, pear and kiwi, diff <(sort a.txt) <(sort b.txt) printed:
1d0
< apple
2a2
> kiwi
and exited with status 1, diff‘s code for “files differ.” Without process substitution, the same comparison needs two sort commands writing to temporary files, a diff on those files, and a cleanup step, plus care that the temp files do not collide with another run.
comm and paste
comm needs sorted input and prints lines in common, so comm -12 <(sort a.txt) <(sort b.txt) printed fig and pear, the fruit in both lists. paste <(seq 3) <(printf 'a\nb\nc\n') joined two generated columns side by side into 1 a, 2 b, 3 c. Anything that takes two or more file arguments can take two or more commands this way. The same pattern compares a remote file to a local one, as in diff <(ssh nas cat /etc/fstab) /etc/fstab, or a configuration file before and after a tool rewrites it, without saving a copy first. It also works for commands that read a list of names from a file argument, letting a quick grep or find stand in for a file that would otherwise have to be written and remembered.
Writing to several commands at once
tee with output substitutions
The >(list) form turns tee into a fan-out. tee writes its input to each filename it is given and to standard output, so:
tee >(gzip -c > nums.gz) >(sha256sum > nums.sha) < nums.txt | wc -lread a 100,000-line file once and sent it to three places: gzip produced a 215,157-byte compressed copy, sha256sum wrote the file’s checksum, and wc -l counted 100,000 lines. A backup script can compress, checksum and log the size of a stream in one pass, without reading a large file three times. For data arriving over a network or from a slow disk, reading once instead of three times is the difference between one long wait and three.
A timing caveat
The output substitutions run asynchronously, so the main command can finish before they do. In the test, a short sleep was needed before checking that nums.gz and nums.sha existed. A script that uses >(...) and immediately reads the results can see an incomplete file. The fix is to wait for those processes, which leads to the next problem.

The exit status you do not get
Failures are hidden
A process substitution’s exit status is not part of the command that uses it. In the test, cat <(exit 3) printed nothing and returned 0, because cat itself succeeded at reading an empty stream. Nothing in $? or PIPESTATUS showed the 3, and set -o pipefail does not cover process substitutions. A diff <(curl ...) <(curl ...) where one download fails will happily compare an empty stream to a full one.
wait $! can recover it
Bash offers a partial fix. The Bash manual’s job control builtins say that wait with no arguments covers “the last-executed process substitution, if its process id is the same as $!” and that wait -n waits for “any job or process substitution, to complete.” In the test, cat <(exit 3); wait $! returned 3. With one substitution, this recovers its status. With several, only the last one’s process ID is in $!, so scripts that need every status are better off writing to temporary files and checking each command directly.
Keeping variables from a loop
The pipe problem, solved
Process substitution is also the standard fix for losing variables in a while loop. A loop on the right side of a pipe runs in a subshell, so its changes vanish. Feeding it from < <(command) keeps the loop in the main shell. In the test, n=0; while read -r x; do n=$((n+1)); done < <(seq 5) left n at 5.
That line contains two separate symbols: a normal input redirection <, then a space, then the process substitution <(seq 5). Writing <<(seq 5) without the space is a syntax error, because << starts a here-document.

Compared with the alternatives
Command substitution stores everything
The closest relative is command substitution, $(command), which captures output into a string. It looks similar but behaves differently in two measurable ways. First, it strips trailing newlines: x=$(printf "a\n\n\n") left x holding just a, while cat <(printf "a\n\n\n") passed all three newlines through. For a file comparison, those lost lines are a silent change to the data.
Second, it holds the whole output in memory. Feeding two million numbers from seq into wc -l through < <(seq 1 2000000) peaked at about 3.3 MB of memory in the shell process, as reported by GNU time. Capturing the same output with v=$(seq 1 2000000) produced a 14,888,895-character string and peaked at about 32 MB. Process substitution streams; command substitution buffers, and the gap grows with the size of the output.
Named pipes are the manual version
Under the hood, process substitution uses either /dev/fd paths or named pipes. A named pipe created by hand with mkfifo shows up in ls -l with a p in the first column, and works the same way: in the test, sort a.txt wrote into the FIFO from the background while diff fifo1 <(sort b.txt) read from it and printed the same differences as before. The difference is housekeeping. A hand-made FIFO has a name in the filesystem that must be created, avoided by other scripts and deleted afterwards. Process substitution does all three automatically, which is most of its appeal.
Here-strings for small inputs
For feeding a single short string into a command, a here-string, command <<< "$text", is simpler still. It does not run another process at all. Process substitution earns its place when the input is the live output of a command, especially a large one, or when a program insists on a filename.
Where it breaks
sh is not Bash
Process substitution is a Bash, Zsh and Ksh feature, not part of the POSIX shell. On the Ubuntu test system, /bin/sh is a link to dash, and sh -c 'diff <(echo a) <(echo a)' failed with Syntax error: "(" unexpected. Scripts that use it need #!/usr/bin/env bash or #!/bin/bash as their first line, and must not be run with sh script.sh, which ignores the shebang. Cron jobs and container entrypoints that call sh by default are a common place for this to surface.
The filename only lasts one command
The path /dev/fd/63 refers to a descriptor that exists only while the command that received it is running. Storing it in a variable does not work: in the test, f=<(echo once); cat $f failed with cat: /dev/fd/63: No such file or directory, because the descriptor was closed as soon as the assignment finished. The same is true of programs that try to open the path twice or seek within it. Process substitution produces a pipe, readable once from start to finish, so tools that need to rewind a file, such as some image or archive tools, need a real temporary file instead.
When to choose it
Process substitution fits best for quick comparisons, fan-out with tee and feeding loops, where the commands involved are reliable or a failure would show up anyway. For long scripts where every step’s success matters, temporary files created with mktemp and removed in a trap are more verbose but leave every exit status visible.
Sources
- GNU Bash manual, “Process Substitution”: https://www.gnu.org/software/bash/manual/html_node/Process-Substitution.html
- GNU Bash manual, “Job Control Builtins” (wait): https://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html
