Linux Shell Scripting Cheat Sheet/Use process substitution

Pass command output as a pseudo-file.

Section: Input Output and Pipelines

Use process substitution

bash
bash
diff <(sort old.txt) <(sort new.txt)
Explanation

Handy when a command expects file arguments but you want to compare pipeline output.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Input Output and Pipelines
Redirect stdout to file
Write output to a file, overwriting it.
OpenIn sheetbashsame section
Append stdout to file
Append output to an existing file.
OpenIn sheetbashsame section
Redirect stderr to file
Send errors to a separate file.
OpenIn sheetbashsame section
Redirect stdout and stderr together
Capture all output in one file.
OpenIn sheetbashsame section
Pipe stdout to another command
Send output of one command as input to another.
OpenIn sheetbashsame section
Prompt user for input
Read a value interactively.
OpenIn sheetbashsame section