How to pipe multiple commands into a single command in the shell? (sh, bash, …)
Use parentheses ()’s to combine the commands into a single process, which will concatenate the stdout of each of them. Example 1 (note that $ is the shell prompt): $ (echo zzz; echo aaa; echo kkk) | sort aaa kkk zzz Example 2: (setopt; unsetopt; set) | sort