• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

UnixArena

  • Home
  • kubernetes
  • DevOps
    • Terraform
    • Jenkins
    • Docker
    • Openshift
      • OKD
    • Ansible engine
    • Ansible Tower
      • AWX
    • Puppet
  • Cloud
    • Azure
    • AWS
    • Openstack
    • Docker
  • VMware
    • vCloud Director
    • VMware-Guests
    • Vcenter Appliance 5.5
    • vC OPS
    • VMware SDDC
    • VMware vSphere 5.x
      • vSphere Network
      • vSphere DS
      • vShield Suite
    • VMware vSphere 6.0
    • VSAN
    • VMware Free Tools
  • Backup
    • Vembu BDR
    • Veeam
    • Nakivo
    • Azure Backup
    • Altaro VMBackup
    • Spinbackup
  • Tutorials
    • Openstack Tutorial
    • Openstack Beginner’s Guide
    • VXVM-Training
    • ZFS-Tutorials
    • NetApp cDot
    • LVM
    • Cisco UCS
    • LDOM
    • Oracle VM for x86
  • Linux
    • How to Articles
    • Q&A
    • Networking
    • RHEL7
  • DevOps Instructor-led Training
  • Contact

How to Create Animated GIFs from Linux Terminal Output: A Step-by-Step Guide

May 1, 2024 By Cloud_Devops Leave a Comment

Capturing and sharing terminal sessions has never been easier with Asciinema, a powerful tool for recording command-line interactions. In this blog post, we’ll explore how to harness the capabilities of Asciinema to create captivating GIF animations from your terminal sessions. Whether you’re documenting a tutorial, showcasing your command-line prowess, or simply adding visual appeal to your technical content, generating GIFs with Asciinema opens up a world of possibilities. Join us as we dive into the step-by-step process of recording terminal sessions, converting them into animated GIFs, and unleashing the full potential of Asciinema for your projects.

Prerequisites:

  • RedHat Linux / Cent OS/Ubuntu
  • Internet connectivity
  • Docker software on Linux VM

1. Login to the Linux machine: Login to the Linux machine in which you would like to capture the command outputs in gif animated format.

2. Install Asciinema: If you haven’t already, install Asciinema on your Linux system by following the instructions on the official website.

[root@centos9 ~]# dnf install asciinema
Last metadata expiration check: 2:14:51 ago on Wed 01 May 2024 04:39:52 AM UTC.
Package asciinema-2.2.0-4.el9.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@centos9 ~]#

3. Record Your Terminal Session: Open a terminal window and start recording your terminal session using the “asciinema rec” command. This will start recording your terminal session and save it to a file named uademo1.cast.

[root@centos9 ~]# asciinema rec uademo1.cast
asciinema: recording asciicast to uademo1.cast
asciinema: press or type "exit" when you're done
[root@centos9 ~]#

4. Perform Actions: Perform the actions you want to record in the terminal. This could be running commands, navigating directories, or executing scripts.

5. Stop Recording: Once you’re done recording, press Ctrl + D to stop the recording session.

6. Convert to GIF: To convert the recorded session to a GIF, you can use the asciicast2gif tool provided by Asciinema. Run the following command:

[root@centos9 ~]# docker run --rm -v $PWD:/data asciinema2/asciicast2gif -t asciinema uademo1.cast uademo1.gif
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
==> Loading uademo1.cast...
==> Spawning PhantomJS renderer...
==> Generating frame screenshots...
==> Combining 28 screenshots into GIF file...
==> Done.
[root@centos9 ~]#

Replace uademo1.cast with the filename of your recorded session and uademo1.gif with the desired filename for the GIF output.

Colour theme: asciinema, tango, solarized-dark, solarized-light, monokai (default: asciinema). You can choose any one of the themes using the “-t” option.

7. View the GIF: Once the conversion is complete, you can view the generated GIF using any image viewer or web browser. It will be available in your current directory

Conclusion:

By following these steps, you can easily record your terminal sessions using Asciinema and convert them into GIFs for sharing or embedding in your blog posts or documentation.

Example:

Install Asciinema
Convert asciinema cast to gif

Filed Under: Linux, Linux - How to ?, Redhat-LINUX Tagged With: AWS, Cloud, DevOps, Linux, RHEL7

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow UnixArena

  • Facebook
  • LinkedIn
  • Twitter

Copyright © 2025 · UnixArena ·

Go to mobile version