The script command records everything shown in a terminal session. It is useful when you want to capture troubleshooting steps, command output, or a repeatable install log.
Start recording
script session.log
Run your commands as usual. When finished, exit the recording session.
exit
View the log
less session.log
Avoid recording passwords, tokens or private data. The output is saved as plain text in the log file.