Lucas Vieites .com Logo
Lucas Vieites .com
«I intend all my puns»

Redirect a command's output to stdout and also a file

 

What you are looking for is the tee command:

ls -a | tee output.file

If you want to include the error output too (stderr):

your_command [arguments...] 2 >&1 | tee output.file

Author:   ✦  Published:   ✦  Updated:   ✦