Many operations in Linux can be completely performed using the shell, and to record these operations, there is no need to capture the entire or part of the screen; you can directly record the shell’s input and output. Previously, I introduced using script and scriptreplay to record and replay shell logs, but script has a slight inconvenience due to its complex parameters, and the generated logs are divided into two parts.
This time, I recommend a simpler program called asciinema. Although it cannot specify playback speed, it is much easier to operate.
As shown below, you can record, replay, directly output to the screen, and upload the logs to a website.
$ asciinema usage: asciinema [-h] [--version] {rec,play,cat,upload,auth} ...Record and share your terminal sessions, the right way.positional arguments: {rec,play,cat,upload,auth} rec Record terminal session play Replay terminal session cat Print full output of terminal session upload Upload locally saved terminal session to asciinema.org auth Manage recordings on asciinema.org account
Example
To record, use asciinema rec followed by the filename, which will open a new shell to start recording and remind you to use exit or <ctrl+d> to stop recording.
$ asciinema rec 20250529asciinema: recording asciicast to 20250529asciinema: press <ctrl-d> or type "exit" when you're done ________________________________________________________< When you feel it's not working, you walk to the zebra crossing, and at that moment, you are a pedestrian > -------------------------------------------------------- \ \ /\_)o< | \ | O . O| \_____/ $ exitexitasciinema: recording finishedasciinema: asciicast saved to 20250529
To replay, use asciinema play followed by the filename.
$ asciinema play 20250529 ________________________________________________________< When you feel it's not working, you walk to the zebra crossing, and at that moment, you are a pedestrian > -------------------------------------------------------- \ \ /\_)o< | \ | O . O| \_____/~$ exitexit
If you want to copy a segment of operations, simply use asciinema cat followed by the filename to select it.