Record Screen as Animated GIF in Ubuntu with Byzanz

We have previously shown you how to record your screen as an animated GIF in Windows and Mac OS X, but what about Linux? If you are a Linux user and are looking for ways to record your screen as an animated GIF, byzanz is the app for you.

Byzanz is a simple command line tool to record a running X desktop to an animation suitable for presentation in a web browser, which in this case, refers to an animated GIF. While the support and development stopped years ago, the current version is still working well on Ubuntu 14.10.


For Ubuntu 14.04 and above, Byzanz is available in the Universe Repository. To install, simply search for it in Ubuntu Software Center,or use the command:

sudo apt-get install byzanz

For Fedora, you can use the command:

sudo yum install byzanz


The command to use Byzanz is byzanz-record. To get started, open a terminal and type:


The texts in uppercase are the options that you need to change. Change the DURATION to the length of time to record the animation. The DELAY option is optional, and when set will delay for the specified time before the recording starts. The X-COORDINATE and Y-COORDINATE refer to the location on the screen for it to start capturing and the WIDTH and HEIGHT is the size of the recording. For example, to record the whole desktop for 10 seconds with a 5 second delay, use the command:

byzanz-record -d 10 --delay=5 -x 0 -y 0 -w 1440 -h 900 desktop-animation.gif


Note: you can add the -v flag to get it to display the progress of the recording.

Extending Byzanz

By default, you will need to specify the coordinates of the recording area and the width and height for byzanz to work. Won’t it be great if there is a GUI tool that you can use to record a window? Here is the bash script that you can use as a GUI for Byzanz.

Open a text editor and paste the following code to it:

# AUTHOR:   (c) Rob W 2012, modified by MHC (
# NAME:     GIFRecord 0.1
# DESCRIPTION:  A script to record GIF screencasts.
# DEPENDENCIES:   byzanz,gdialog,notify-send (install via sudo add-apt-repository ppa:fossfreedom/byzanz; sudo apt-get update && sudo apt-get install byzanz gdialog notify-osd)
# Time and date
TIME=$(date +"%Y-%m-%d_%H%M%S")
# Delay before starting
# Standard screencast folder
# Default recording duration
# Sound notification to let one know when recording is about to start (and ends)
beep() {
    paplay /usr/share/sounds/freedesktop/stereo/message-new-instant.oga &
# Custom recording duration as set by user
USERDUR=$(gdialog --title "Duration?" --inputbox "Please enter the screencast duration in seconds" 200 100 2>&1)
# Duration and output file
if [ $USERDUR -gt 0 ]; then
# Window geometry
read X < <(awk -F: '/Absolute upper-left X/{print $2}' <<< "$XWININFO")
read Y < <(awk -F: '/Absolute upper-left Y/{print $2}' <<< "$XWININFO")
read W < <(awk -F: '/Width/{print $2}' <<< "$XWININFO")
read H < <(awk -F: '/Height/{print $2}' <<< "$XWININFO")
# Notify the user of recording time and delay
notify-send "GIFRecorder" "Recording duration set to $D seconds. Recording will start in $DELAY seconds."
#Actual recording
sleep $DELAY
byzanz-record -c --verbose --delay=0 --duration=$D --x=$X --y=$Y --width=$W --height=$H "$FOLDER/GIFrecord_$TIME.gif"
# Notify the user of end of recording.
notify-send "GIFRecorder" "Screencast saved to $FOLDER/GIFrecord_$TIME.gif"

Save the script as "byzanz-gui" (or any other name that you prefer) to your Home folder without any extension.

Next, grant the script executable permission:

chmod +x byzanz-gui

Lastly, execute the script:


In the window that pops up, enter the duration for the recording and click OK.


You will notice that your mouse cursor has become a crosshair. Click on the window that you want to record. It will start the recording with a 10 second delay.


You can find the animated GIF in your Pictures folder.

There is also another script that allows you to capture a region instead of a window. However, for that to work, it requires xrectsel which you have to download, compile and install manually. For that, we won't cover the script in this tutorial.


Byzanz is not the only tool that can record your screen as an animated GIF, but it is one that can do the job well. While it doesn't come with a beautiful user interface like other screen recording tools for Windows and Mac, being a command line tool gives it the benefit of customizability and can be easily extended with simple bash script.


Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox