Record a terminal session to a log file so troubleshooting work can be reviewed or shared without relying on memory. Practice a clean workflow: reset the screen, capture the session, run a command for evidence, exit correctly, then review the transcript.
You are troubleshooting a legacy system and need to document exactly what was typed and what the system returned. You will clear the screen to reduce noise, record the session to a log file, capture a hostname check as evidence, then end the session cleanly and review the transcript.
Session transcripts are useful for peer review, change records, and escalation. Logging your steps also protects you when diagnosing a system with inconsistent behavior.
script.
hostname during the recorded session.
clear to reduce noise before
capturing evidence.
script with an explicit
output filename.
hostname.
exit.
cat or
less.
clear
Clearing the screen is a simple way to remove unrelated output and make it easier to capture a clean transcript. It does not delete history; it only redraws the terminal view.
script lab53.log
script
records everything printed to the terminal during the
session and writes it to the file you provide. This is a
lightweight way to generate a shareable transcript of what
happened.
hostname
Running hostname during the recorded session
provides a simple identity artifact showing which host the
transcript applies to.
termhost.localdomain
exit
When script is running, the shell you are using
is a subshell created for the recording session. Exiting
cleanly ends the recording and writes the closing footer to
the log.
cat lab53.log
# OR
less lab53.log
Use cat for quick output or less
for paging through longer transcripts. This validates the
recording completed successfully and captured expected
content.
Script started on ...
hostname
termhost.localdomain
Script done on ...
clear
: Clears the terminal display to reduce on-screen clutter.
script <file>
: Records a terminal session and writes the transcript to a
file.
lab53.log) makes the output predictable.
hostname
: Prints the system hostname.
exit
: Ends the current shell session. When used inside a
script
session, it stops recording and closes the transcript.
cat <file>
: Outputs a file to standard output.
less <file>
: Views a file interactively with paging and search.