4

Record Linux Terminal Sessions and generate gif images

 2 years ago
source link: https://computingforgeeks.com/terminalizer-record-your-terminal-and-generate-animated-gif-images-on-linux/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Record Linux Terminal Sessions and generate gif images

Well, you got this fancy command output from your terminal and want to make an animated image out of it?. Terminalizer is a command line tool that will help record your Linux terminal and generate animated gif images. In this article, we are going to learn how to install and use Terminalizer to generate animated gifs on Linux.

How to Install Terminalizer on Linux

To install Terminalizer, follow the following procedure.

Step 1. Install Node.js

Use our guide below to install on a Linux system. Choose to go with LTS or latest release.

How to install Node.js Versions in Linux

Step 2: Install build tools for Terminalizer

Terminalizer uses some C++ addons that require building. This needs to be installed before you can start installing and using Terminalizer.

For CentOS and other RHEL derivatives;

sudo yum install -y gcc-c++ make

For Ubuntu and other Debian derivatives;

sudo apt-get -y install build-essential

For Arch Linux / Manjaro:

sudo pacman -S gcc make cmake

You can confirm the versions of packages installed using gcc -v  and make -v

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) 

$ make -v
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Step 3. Install Terminalizer on Linux

Once all dependencies have been installed, proceed to install Terminalizer on your Ubuntu / CentOS and Arch Linux system using npm package manager.

It is recommended to first install node-gyp using npm to avoid later issues.

$ npm install -g node-gyp
/home/jmutai/.nvm/versions/node/v10.15.3/bin/node-gyp -> /home/jmutai/.nvm/versions/node/v10.15.3/lib/node_modules/node-gyp/bin/node-gyp.js
+ [email protected]
added 100 packages from 67 contributors in 6.463s

Now install terminalizer:

$ npm install terminalizer

Using Terminalizer

To start recording your terminal sessions, just type:

$ terminalizer record <session-name>

Example:

$ terminalizer record  test-demo
defaultConfigPath
The recording session is started
Press CTRL+D to exit and save the recording

For nvm installation, terminalizer binary will be located in:

~/node_modules/.bin/terminalizer

The recording will start in the background and a file called test-demo.yml is created in the current directory.

You can open it using any editor to edit the configurations and the recorded frames. To replay your recording using the terminalizer play command.

$ terminalizer play test-demo

When done, you can render the recording as an animated gif using render command:

$ terminalizer render test-demo
Rendering frame 24/24 100% [==============================] 0.0s
Merging frame 24/24 100% [==============================] 0.0s

Successfully Rendered
The animated GIF image is saved into the file:
/home/jmutai/render1532867073991.gif

To generate a web player for a recording file

$ terminalizer generate <recordingFile>

To upload a recording file and get a link for an online player

$ terminalizer share <recordingFile>

The default config.yml file is stored at root directory the of the project. Execute the below command to copy it to your current directory.

Use any editor to edit the copied config.yml, then use the -c option to override the default one.

$ terminalizer config

This guide helped you in using Terminalizer to record your terminal sessions in Linux and generate gif images. You can also check:

Ten Best Terminal Emulators for Linux

How to Share your Linux Terminal in Web Browser with GoTTY

How To Install and Use Tmux on Linux

How to Install and Use lazygit – A simple terminal UI for git commands


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK