Terminal Recorders allow us to record and replay your command line activities and export it in various convenient forms like text, html, GIF etc depending on the user requirements. We have some of the lightweight and very efficient terminal recorders in this tutorial. Most of them convert the terminal recordings to a convenient form which can be shared across the world globally. The main advantage of some of these terminal recorders in comparison to desktop recorders such as Vokoscreen, Kazam, Recordmydesktop or Simplescreenrecorder is that it records all standard terminal input, output, and error as a plain ASCII text with ANSI escape code. It even exports the output to a minuscule formatted file which can help in recording longer terminal sessions. These file formats can be even shared via simple file transfer or by a public website as part of embedded html code. And finally, in case of any mistake made during your terminal session, your recorded terminal session can be retrospectively edited using any text editor or corrected by adjusting the record timings.
Let's start with some of the useful tools, which can be used to rapidly share your terminal activity with a screencast, by recording and playback TTY output of a text-mode program.
You can use this tool to record your terminal activity and compile it in GIF or APNG format without any external dependencies, bash scripts, gif concatenation. You can install it using npm package. First of all, you can install nodejs to enable npm package to start with the installation. Please follow these steps to install NodeJS on a CentOS 7 server.
# yum install -y gcc-c++ make # curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash - #yum install -y nodejs #node -v v6.10.2 # npm -v 3.10.10
Once npm is enabled, you can install ttyStudio with the below command:
# npm -g install ttystudio
We can record a terminal activity using the command
"ttystudio filename.gif". Please see my example below:
# ttystudio linoxide.gif
Just run this above command, it will open up a fresh window to start up with recording. Once you're done press
"CTRL+Q" to end recording.
# ttystudio linoxide.gif initializing writer writing image writing head building gct (may take a while) .Killed
This will provide a .gif file in the current working directory as specified in the initial command execution.
~]# ls linoxide.* linoxide.frames.json linoxide.gif
You can play these recordings by just executing the command below:
# ttystudio --play linoxide.frames.json
This program allows you to record & replay your terminal activity and publish it. It is made in Ruby and the package is available for almost all Linux OS distributions. Please follow these steps to install this program.
# yum install rubygems # gem install shelr
You can start recording by running the command
"shelr record". Please see the example below:
# shelr record Provide some title for your record: Shelr Example /root/.local/share/shelr/1493638181/meta -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= => Your session started => Please, do not resize your terminal while recording => Press Ctrl+D or 'exit' to finish recording -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Script started, file is /root/.local/share/shelr/1493638181/typescript You can end the session by typing the exit command.
Shelr can be easily used, to start a recording session as you see in this example. Once you finish recording, you can type
exit to end the session or just hit
CTRL+D. Then you will get the below message.
Script done, file is /root/.local/share/shelr/1493638181/typescript -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= => Session finished Replay : shelr play last Publish : shelr push last
You can play your recorded session using this play command. Just like this
"shelr play 1493638181". If you're not aware of the shelr ID you can just run this command
"shelr list" to list out the shelr records.
# shelr list 1493638059 : My work 1493638181 : Shelr Example
Showterm is an open-source terminal record and upload application that will let you record your terminal and easily upload it. It will record all your terminal activity in text-based and upload to showterm.io as a video. Once uploaded it will generate a link for you to share with your team members or embed it in your website as an iframe. It is a rubygem application similar to the one above. Let's see how to install it.
# yum install rubygems # gem install showterm
You can start recording the session by just running the command
"showterm" and type exit once you finish recording.
# showterm showterm recording. (Exit shell when done.)
After exiting the session, you will get a message with the recorded URL link to access via a browser.
# exit exit showterm recording finished. Uploading... http://showterm.io/6f5883e4542f05613d0fb
You can even view the recorded terminal demo here.
TermRecord is a simple terminal session recorder that outputs the records to an easy-to-share self-contained HTML output. It is an open-source tool written in python. Hence, we can install this module using
pip. We need to install the
EPEL repository to install the pip.
#yum install epel-release #yum install python-pip # pip install TermRecord
You can upgrade the installed PIP module by running this command.
# pip install --upgrade pip Collecting pip Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 515kB/s Installing collected packages: pip Found existing installation: pip 8.1.2 Uninstalling pip-8.1.2: Successfully uninstalled pip-8.1.2 Successfully installed pip-9.0.1
We can easily record a terminal using the TermRecord. You can simply run this command to start recording your session.
TermRecord -o /path to the/output file/
In my example, I've recorded my terminal and output it to my default server document root to access it via a web browser.
# TermRecord -o /var/www/html/termrecord.html Script started, file is /tmp/tmp7SitII Exit the session when done. # exit exit Script done, file is /tmp/tmp7SitII
You can access the recorded session at
http://Your Server IP/termrecord.html Any subsequent commands that are typed from the terminal will be saved to the output HTML file. The output file will also store timing information so that the whole terminal session can be replayed in the same speed as you are typing. You can end your recording by just typing exit.
You can open up the recorded output via a web browser just like this. You can play, pause or restart or even adjust the recording speed with this.
ttyrec is a terminal recorder that records data and it can be played back with the help of
ttyplay command. ttyrec is just a derivative of script command for recording timing information with microsecond accuracy as well. ttytime can be used to get the record time information. It can record emacs -nw, vi, lynx, or any programs running on tty. Let's see how to install this tool on our CentOS system.
#wget http://0xcc.net/ttyrec/ttyrec-1.0.8.tar.gz #wget http://paperlined.org/apps/rhel/building/ttyrec-1.0.8.RHEL5.patch #tar -xvzf ttyrec-1.0.8.tar.gz #cd ttyrec-1.0.8 #patch -i ../ttyrec-1.0.8.RHEL5.patch patching file Makefile patching file ttyrec.c #make gcc -O2 -DHAVE_openpty -c -o ttyrec.o ttyrec.c gcc -O2 -DHAVE_openpty -c -o io.o io.c gcc -O2 -DHAVE_openpty -o ttyrec ttyrec.o io.o -lutil gcc -O2 -DHAVE_openpty -c -o ttyplay.o ttyplay.c gcc -O2 -DHAVE_openpty -o ttyplay ttyplay.o io.o gcc -O2 -DHAVE_openpty -c -o ttytime.o ttytime.c gcc -O2 -DHAVE_openpty -o ttytime ttytime.o io.o
Now, you can copy or symlink all binaries like,
/usr/bin directory to access it globally.
You can start recording the sessions by running the command
ttyrec When we run the above command recording of the terminal session will start and when you type exit, the recording will be stopped and a file name
‘ttyrecord’ will be created in the current directory. You can play the recorded session by just running the command below:
These are the commonly used options while playing the records.
Usage: ttyplay [OPTION] [FILE] -s SPEED Set speed to SPEED [1.0] -n No wait mode -p Peek another person's ttyrecord
We can also change the speed by using special keys like:
+ or f double the speed of playback. – or s : halve the speed of playback. 0 : set playback speed to 0, pausing playback. 1 : set playback to speed 1.0 again.
Furthermore, you can determine the recorded time for the data in seconds using
# ttytime ttyrecord 25 ttyrecord
This is a command in Linux, which is used to record the terminal activities. It stores terminal activities in a log file that can be named by a user, or it takes a default file name, namely typescript when nothing is provided by the user.
script [options] - -timing=timing_file log_filename
You can use the below command to start recording the terminal to a log file.
# script linoxidedemo.txt Script started, file is linoxidedemo.txt
This will start your terminal recording and you can type exit to stop recording.
# exit exit Script done, file is linoxidedemo.txt
Once done, you can view this log file to know the recorded information. Now let's see how to replay that recorded information using
scriptreplay command. You can replay the terminal records only by timing information. For that, we need to record the terminal, saving the timing information. You can do it using the command below:
#script --timing=time.txt linoxidedemo.txt
Finally, you can replay it using the command
scriptreplay just like this.
#scriptreplay --timing=time.txt linoxidedemo.txt1
Asciinema is an open-source, simple program which you can install on your system to record what you do in the terminal. The recorded session is automatically loaded to asciinema website and you are provided wtih a URL to share the recorded session. You can install it with just one command.
#yum install asciinema
Once installed you can start recording by running the command
"asciinema rec" like this:
# asciinema rec ~ Asciicast recording started. ~ Hit Ctrl-D or type "exit" to finish.
You can exit the session when you're done with the recording to provide you with the Recorded URL to share with your team members.
# exit exit ~ Asciicast recording finished. ~ Press <Enter> to upload, <Ctrl-C> to cancel.
Now, you can share this URL provided to browse from anywhere across the globe.
Recterm is a simple terminal recording tool along with audio. It make use of asciinema, asciinema2gif, sox and ffmpeg to perform its task. Hence, before this software installation, we need to make sure our system has all libraries supporting the audio/video formats. In such a server environment, we can install recterm with these simple steps.
# git clone https://github.com/rascoro1/recterm.git # cd recterm/ # chmod +x recterm.sh to_gif.sh
Once installed you can start recording by running the command
# ./recterm.sh linoxide_demo ~ Asciicast recording started. ~ Hit Ctrl-D or type "exit" to finish.
As specified you can type exit to end the recording session.
# exit exit ~ Asciicast recording finished. Your MP4 file with audio is ready:
After a series of conversion process, your recorded session with audio will be present inside
linoxide_demo folder as per this example. You can see the detailed installation of recterm.
These are some of the command line tools which you can use to record your terminal activities. These programs are quite easy to use and help a lot when you need to run the same batch of commands several times. They can even help the System administrators to troubleshoot and manage their servers effectively. I hope this guide is useful for you. Please post your valuable comments and suggestions on this.