In my previous article, How to capture terminal sessions and output with the Linux script command, covering the script
command and some common options, you learned how to record your interactive terminal sessions. This follow-up article demonstrates how to replay those recorded terminal sessions.
The only caveat with replaying your sessions is that the sessions aren't "live." The playback feature only replays what's in the file and doesn't reflect any changes you've made since you created the scriptfile
. In other words, if in your recorded session, you issue the ls
command to see the following list of files:
$ ls
test1 test2 test3 test4
and then decide to add a file named test5
outside of the script
recording, it will not appear when the session is replayed. Only what you see in the scriptfile
appears in the replay. You can edit the scriptfile
to include the test5
file, but otherwise it won't appear.
[ You might also enjoy reading: Sysadmin fails: When service dependencies go wrong ]
Session replay
It is simple to replay a recorded session and the syntax is almost identical to recording a session, except that you use the scriptreplay
command. Continuing with the example from the previous article:
$ scriptreplay --timing=script_log scriptfile
The interesting point to note about replaying your scripts is that the playback mimics your speed, hesitations, backspacing, and misspelled commands. You can manipulate the speed with scriptreplay
options but it isn't something that I've ever needed to do. Check the man page for options.
The following is an example of a standard script file being created. It is played back using the command above. You'll notice that I'm saving the script_log
and the scriptfile
to the directory above my working directory. This ensures that there's no mixup or file listing that's confusing to the person watching the playback.
Now, watch the replay of this script to see that the replay has exactly the same pacing as the original.
Check out this more elaborate script as a demonstration of the kind of complexity that you can incorporate into a script
command-created terminal session recording:
As you can see, terminal session recordings can be pretty elaborate. The documentation recommends not using the script
command within non-interactive sessions, such as automated scripts, because the behavior might not be what you expect. Experiment at your own peril.
[ Free course: Red Hat Satellite Technical Overview. ]
Wrap up
These examples demonstrate how easy it is to create recorded terminal sessions and how to replay them for your audience. There's nothing magical about it. Be patient and remember it's not necessarily bad to have typos or other mistakes in your videos, and it can be quite frustrating to try to create a perfect one.
Über den Autor
Ken has used Red Hat Linux since 1996 and has written ebooks, whitepapers, actual books, thousands of exam review questions, and hundreds of articles on open source and other topics. Ken also has 20+ years of experience as an enterprise sysadmin with Unix, Linux, Windows, and Virtualization.
Follow him on Twitter: @kenhess for a continuous feed of Sysadmin topics, film, and random rants.
In the evening after Ken replaces his red hat with his foil hat, he writes and makes films with varying degrees of success and acceptance. He is an award-winning filmmaker who constantly tries to convince everyone of his Renaissance Man status, also with varying degrees of success and acceptance.
Nach Thema durchsuchen
Automatisierung
Das Neueste zum Thema IT-Automatisierung für Technologien, Teams und Umgebungen
Künstliche Intelligenz
Erfahren Sie das Neueste von den Plattformen, die es Kunden ermöglichen, KI-Workloads beliebig auszuführen
Open Hybrid Cloud
Erfahren Sie, wie wir eine flexiblere Zukunft mit Hybrid Clouds schaffen.
Sicherheit
Erfahren Sie, wie wir Risiken in verschiedenen Umgebungen und Technologien reduzieren
Edge Computing
Erfahren Sie das Neueste von den Plattformen, die die Operations am Edge vereinfachen
Infrastruktur
Erfahren Sie das Neueste von der weltweit führenden Linux-Plattform für Unternehmen
Anwendungen
Entdecken Sie unsere Lösungen für komplexe Herausforderungen bei Anwendungen
Original Shows
Interessantes von den Experten, die die Technologien in Unternehmen mitgestalten
Produkte
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud-Services
- Alle Produkte anzeigen
Tools
- Training & Zertifizierung
- Eigenes Konto
- Kundensupport
- Für Entwickler
- Partner finden
- Red Hat Ecosystem Catalog
- Mehrwert von Red Hat berechnen
- Dokumentation
Testen, kaufen und verkaufen
Kommunizieren
Über Red Hat
Als weltweit größter Anbieter von Open-Source-Software-Lösungen für Unternehmen stellen wir Linux-, Cloud-, Container- und Kubernetes-Technologien bereit. Wir bieten robuste Lösungen, die es Unternehmen erleichtern, plattform- und umgebungsübergreifend zu arbeiten – vom Rechenzentrum bis zum Netzwerkrand.
Wählen Sie eine Sprache
Red Hat legal and privacy links
- Über Red Hat
- Jobs bei Red Hat
- Veranstaltungen
- Standorte
- Red Hat kontaktieren
- Red Hat Blog
- Diversität, Gleichberechtigung und Inklusion
- Cool Stuff Store
- Red Hat Summit