Ubuntu – How to both display a command line’s output on console and save the output into a text file

aptcommand line

How can I run sudo apt-get install by BOTH seeing the process of installation (long in my case) and saving its output into a text file ?

Best Answer

use the script command. It will copy everything that goes to screen in a file

script -c "sudo apt-get install things" script-file.script