Friday 24 March 2017

How to Record Your Terminal Session on Linux by using tty studio





TTY STUDIO

Recording a terminal session could also be vital in serving to somebody learn a method, sharing information in a visible manner, and additionally presenting a series of commands during a proper manner. regardless of the purpose, there area unit over and over once copy-pasting text from the terminal will not be terribly useful whereas capturing a video of the method is sort of far-fetched and will not be continually potential. in this fast guide, we are going to take a glance at the simplest way to record and share a terminal session in .gif format by using tty studio.

There are many utilities to record your terminal as a gif (like ttyrec). However, most of them have variety of dependencies and also the procedure is very cumbersome. ttystudio may be a new tool developed with zero dependencies and support for gif and png output files. ttystudio is generally JS with a couple of C++ bindings.

TTYSTUDIO installation

We can install ttystudio using npm package manager. In order to use npm, we must install NodeJS by using the following command.
#yum -y install epel-release
Now install nodeja and npm as follows
#yum -y install nodejs npm
Loaded plugins: fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
 * base: mirror.fibergrid.in
 * epel: mirror.vinahost.vn
 * extras: mirror.fibergrid.in
 * updates: mirror.fibergrid.in
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 1:6.9.4-2.el7 will be installed
--> Processing Dependency: libuv >= 1:1.9.1 for package: 1:nodejs-6.9.4-2.el7.x86_64
--> Processing Dependency: libuv.so.1()(64bit) for package: 1:nodejs-6.9.4-2.el7.x86_64
---> Package npm.x86_64 1:3.10.10-1.6.9.4.2.el7 will be installed
--> Running transaction check
---> Package libuv.x86_64 1:1.10.2-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                             Arch                                Version                                                Repository                         Size
========================================================================================================================================================================
Installing:
 nodejs                              x86_64                              1:6.9.4-2.el7                                          epel                              4.6 M
 npm                                 x86_64                              1:3.10.10-1.6.9.4.2.el7                                epel                              2.4 M
Installing for dependencies:
 libuv                               x86_64                              1:1.10.2-1.el7                                         epel                              109 k

Transaction Summary
========================================================================================================================================================================
Install  2 Packages (+1 Dependent package)

Total download size: 7.1 M
Installed size: 26 M
Downloading packages:
(1/3): libuv-1.10.2-1.el7.x86_64.rpm                                                                                                             | 109 kB  00:00:04
(2/3): npm-3.10.10-1.6.9.4.2.el7.x86_64.rpm                                                                                                      | 2.4 MB  00:00:10
(3/3): nodejs-6.9.4-2.el7.x86_64.rpm                                                                                                             | 4.6 MB  00:01:13
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   100 kB/s | 7.1 MB  00:01:13
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:libuv-1.10.2-1.el7.x86_64                                                                                                                          1/3
  Installing : 1:npm-3.10.10-1.6.9.4.2.el7.x86_64                                                                                                                   2/3
  Installing : 1:nodejs-6.9.4-2.el7.x86_64                                                                                                                          3/3
  Verifying  : 1:libuv-1.10.2-1.el7.x86_64                                                                                                                          1/3
  Verifying  : 1:nodejs-6.9.4-2.el7.x86_64                                                                                                                          2/3
  Verifying  : 1:npm-3.10.10-1.6.9.4.2.el7.x86_64                                                                                                                   3/3

Installed:
  nodejs.x86_64 1:6.9.4-2.el7                                                     npm.x86_64 1:3.10.10-1.6.9.4.2.el7

Dependency Installed:
  libuv.x86_64 1:1.10.2-1.el7

Complete!

Then install the ttystudio using the following command

#npm -g install ttystudio
/usr/bin/ttystudio -> /usr/lib/node_modules/ttystudio/bin/ttystudio

> pty.js@0.3.1 install /usr/lib/node_modules/ttystudio/node_modules/pty.js
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.9.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/ttystudio/node_modules/pty.js/.node-gyp"
make: Entering directory `/usr/lib/node_modules/ttystudio/node_modules/pty.js/build'
  CXX(target) Release/obj.target/pty/src/unix/pty.o
  SOLINK_MODULE(target) Release/obj.target/pty.node
  COPY Release/pty.node
make: Leaving directory `/usr/lib/node_modules/ttystudio/node_modules/pty.js/build'
/usr/lib
└─┬ ttystudio@0.0.16
  ├── blessed@0.1.81
  ├─┬ pty.js@0.3.1
  │ ├── extend@1.2.1
  │ └── nan@2.3.5
  └── term.js@0.0.7


Usage of ttystudio
The Usage of ttystudio is also very simple
ttystudio techbuddies.gif 
Just enter any commands as you want. After completion of that, stop the recording by pressing CTRL+Q.
Then ttystudio will start to compile the Terminal activity in GIF format, and save it into the current directory.


No comments: