script
Quick reference for the Unix script command to record terminal sessions and command output for logging, auditing, or documentation
Record history from terminal
script logfile.log
End recording of terminal
exit
Record a certain command output
script -c "ls -la" logfile.log