Bash redirect sdtout and stderr

From Thomas-Krenn-Wiki
Jump to: navigation, search

In this article we describe how you can redirect output in the Bash in Linux sdtout and stderr. It is also commonly referred to as Bash Redirection or Output Redirection.

Bash Redirection

stdout -> Redirection File

programm > file.txt

stderr -> Redirection File

programm 2> file.txt

stdout AND stderr -> Redirection File

programm &> file.txt

stdout -> stderr

programm 1>&2

stderr -> stdout

programm 2>&1

Additional Information

Foto Werner Fischer.jpg

Author: Werner Fischer

Werner Fischer, working in the Web Operations & Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.

Related articles

Archive under Linux (tar, gz, bz2, zip)
Using Md5sum und sha1sum for Checking Downloaded Files
Vi editor tips and tricks