I would like to be able to simply save stdout and stderr when installing software

There are 3 scenarios I would like to address:

  1. When using apt-get
  2. When using apt-get and tee
  3. When using make install

1. When using apt-get

I am having trouble "visualizing" the difference between stdout and stderr in the context of software installation. Indeed, you often get a lot of output on your terminal when installing software and some of it often has warnings. So in this context"

  • Would stderr be completely empty if your installation had worked?
  • Or if it has warning, what is "left" in the stdout?
  • Or would you suggest saving stdout and stderr together in this context?

In any case, would this work?

sudo apt-get package 1>output.txt 2>errors.err

2. When using apt-get and tee

In practise, it would be nice to not only save the stdout and sterr to files but also still view them in my terminal. So using tee, would this be the best work?

sudo apt-get package | tee 1>output.txt 2>errors.err

3. When using make install

Things get complicated here I'm guessing.. Would it be as simple as:

./configure 1>output1.txt 2>errors1.err
make 1>output2.txt 2>errors2.err
make install 1>output3.txt 2>errors3.err

1 Answer 1


I shall address each of these in turn:

$ sudo apt-get install package 1> apt.out 2> apt.err

This may give you some problems if apt-get decides to ask you a question. The prompt will be send to standard output, and redirected in to the file and not displayed to you. If you want to use apt-get in this manner, use its other options to preemptively answer any questions (apt-get --assume-yes install package 1> apt.out 2> apt.err). But be aware that presupposing a 'yes' may lead to unanticipated consequences.

$ sudo apt-get install package | tee 1> apt.out 2> apt.err

This is slightly better, but first let's fix your invocation of tee:

$ sudo apt-get package 2> apt.err | tee apt.out

Your initial invocation didn't properly invoke tee, and then redirected the standard error of tee rather than of apt-get into your error log.

This will work better, but you will not see on your screen any of the presumably helpful information which has been sent to standard error that might advise you as to your reactions if apt-get were to ask you any questions.

$ ./configure 1>output1.txt 2>errors1.err
$ make 1>output2.txt 2>errors2.err
$ make install 1>output3.txt 2>errors3.err

This will do exactly what you expect; you will end up with six files with all the standard error and standard output of the three commands. I would suggest using slightly less abstruse filenames, e. g.:

$ ./configure 1> configure.out 2> configure.err
$ make 1> make.out 2> make.err
$ make install 1> install.out 2> install.err

But I would be more inclined to put them into two files:

$ ( ./configure && make && make install ) 1> build.out 2> build.err

This does two things differently: First it puts all your build commands into one subshell, and magically collects the output streams together. Secondly, it uses the shell's && operator to only run the next command if the previous command was successful.

Note: I have also fixed your invocation of apt-get throughout.

  • Thanks, this is really helpful! Generally speaking, would you recommend one particular option? Or would you simply recommend installing software "normally", without saving anything? I often find myself wondering what is best, as I often feel overwhelmed by how much output I might get in my terminal and I feel it might be safer to save it so I can check properly?
    – mf94
    Jun 12, 2018 at 16:01
  • Since you're new, I would recommend actually looking at both the stdout and stderr as presented until you're comfortable, and only then start looking at making the visible output more terse.
    – DopeGhoti
    Jun 12, 2018 at 17:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .