Here are two ways on who to redirect both standard output and standard error to same file in bash. First the official a recommended way:

printf '%s\n%\n' "Hello bash" > FILE 2>&1

now easier unofficial way:

printf '%s\n%\n' "Hello bash" &> FILE

Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top