Recording desktop activity
For the Record
![](/var/linux_magazin/storage/images/issues/2015/174/command-line-desktop-recorders/78002317_20.png/648988-1-eng-US/78002317_20.png_medium.png)
We look at several tools, ranging from very simple to more complex – that can help you record various desktop activities.
Recording your desktop can serve many purposes: It can be a way of permanently recording a complicated procedure; it can prove that a student has completed an assignment, as the man page for the script
command suggests; or it can enhance documentation, provide animated how-tos, and even assist with automatic testing, depending on the tools you choose.
The tools described in this article operate on several levels. At the simplest level, commands like script
, ttyrec
, and shelr
serve as more permanent alternatives to a shell's history. By contrast, scrot
takes stills, cnee
records not so much visual events as the technical information behind them, and recordmydesktop
produces movies made from desktop events. You could accurately say that recording tools are available for every purpose and level of users.
script
The script
command writes a record of all actions within a shell (Figure 1). It is not much different from viewing a shell's history, except that it writes to file and is stored permanently. Script is one of several dozen commands installed in distributions as part of the linux-utils package.
Once started, script
records every command entered and its output. You can add annotations at the command line between commands if desired. These annotations can be located later by searching for the "command not found" that the shell adds after them.
At its simplest, script
runs from the bare command, saving to the file typescript
and ending when you press Ctrl+D. However, you can record to whatever file you want with the command script FILE
.
You can further specify how the recording file is used with the option -a
or --append
to add new input at the bottom of the content of a previous session. You can use -f
or --flush
to remove previous content and write to the same file.
Additionally, you can start script
with the name of the command you want to run. For example, you can start script
and vi
together with the command:
script --command vi FILE
After recording, you can read the output file with less
, more
, or cat
.
ttyrec, ttytime, and ttyplay
The three related commands ttyrec
, ttytime
, and ttyplay
are intended as an improved version of script
– to be exact, a simplification and a division into three separate commands. Unless another file is specified, the ttyrec
command saves to ./ttyrecord
. You can use the -a
option to append the current recording to a previously record file or use -e COMMAND
to start the command within another application.
Unlike script
, ttyrec
contains no GNU options (longer commands prefixed with two hyphens). It does include an option for uuencode
for protection when transferring remote files, but because uuencode is practically obsolete today, you should check first that the file's receiver knows how to read them.
Once a recording is finished, you can use ttytime FILE
to see a file's length in seconds. This function may help you to identify the contents of the file when the name does not.
To play a recording, use the command ttyplay FILE
. Options in ttyplay are mostly for speed. The -s SPEED
option is a multiple of the default speed. During playback, you can double the speed by pressing either + or f and halve it by pressing - or s. Similarly, pressing 1 returns the playback to normal speed, and pressing 0 stops playback until 1 is pressed again.
Shelr
Shelr is a combination of script
and ttyrec
that records terminal output and replays it in the terminal (Figure 2). Like many Debian commands, it consists of the basic command, followed by sub-commands. More unusually, it includes no options to modify behavior, but this simple structure is still adequate for its purpose.
To begin recording terminal events, enter the command shelr record
. After you give the recording a name, Shelr will continue to record until you either type exit
or press Ctrl+D, then it will save the recording to a file in the sub-directory ~/.local/share/shelr
.
The saved file has a random number for a name, but users are apparently not expected to interact directly with the file. Instead, you can use shelr list
to see a list of recordings, each with the name you entered to start recording.
To replay, run shelr play RECORDING
. Alternatively, you can enter the full path, or on the local machine, run replay last
to show the last recording you made. The playback in all these cases takes a moment to start and can slow when replaying typing, then speed up when a program produces standard input.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.