Linux перенаправляет все (stdout и stderr) в файл

foo > allout.txt 2>&1
bougui