Scenario
You are troubleshooting a legacy system and must document exactly what was typed and what the system returned. 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 support peer review, change records, and escalations. Logging your steps also protects you when diagnosing systems with inconsistent behavior.
Objective
- Clear the terminal screen before starting.
-
Record a troubleshooting session using
script. -
Run
hostnameduring the recorded session. - Exit the recording session properly.
- Review the captured transcript.
Concepts
-
Screen reset using
clearto reduce noise before capturing evidence. -
Session logging using
scriptwith an explicit output filename. -
Collecting a simple host identity artifact with
hostname. -
Cleanly terminating a recorded session using
exit. -
Viewing transcripts using
catorless.
Walkthrough
clear
Clearing the screen removes unrelated output and produces a cleaner transcript. It does not erase shell 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 specified file. This produces a
shareable transcript of the troubleshooting process.
hostname
Running hostname inside the recorded session
provides a simple identity artifact showing which system the
transcript applies to.
termhost.localdomain
exit
When script is running, you are inside a
subshell created for the recording session. Exiting cleanly
stops 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 confirms the
recording completed successfully.
Script started on ...
hostname
termhost.localdomain
Script done on ...
Common breakpoints
The recording session may not have been exited properly.
Ensure you run exit from inside the
script subshell.
Confirm the filename passed to
script. If no name was provided, the default
typescript file may have been created instead.
Clear the screen before starting and avoid running unrelated commands during the recorded session.
Cleanup checklist
Remove the session log if it is no longer needed. This lab does not modify system configuration.
rm -f lab53.log
The transcript file is removed and no artifacts remain from the session.
Reference
-
clear: Clears the terminal display. -
script <file>: Records a terminal session and writes the transcript to a file. -
hostname: Prints the system hostname. -
exit: Ends the current shell session. -
cat <file>: Outputs a file to standard output. -
less <file>: Views a file interactively with paging.