How to record a screenshot by command line in Ubuntu

Know how to capture screenshot GIF and Video with Audio from command line

In today’s session of Terminal Tuts, let’s take a look at how to record a screenshot video using command line from Terminal. Let me introduce to byzanz command line utility.

Byzanz can record your desktop session to an animated GIF image, flv, ogg, and ogv file formats. It supports entire screen capture, a single window, or a specified region. For those preferring the GUI, screenshot recording is possible via command line or via the panel applet.

Installing Byzanz in Ubuntu

This guide is tested on Ubuntu 17.10. It should work good in Linux Mint and elementary OS too.

Step 1) Launch Terminal.

Step 2) Use the following command in the terminal and hit enter.

sudo apt-get install byzanz

Step 3) That’s it. Byzanz should now be installed in your computer.

Finding resolution of your computer’s display by command line

You need to first know the native desktop resolution to start recording the entire screen. To find it out, launch ‘Terminal’ and use this command:

xdpyinfo | grep dimensions

You should see output similar to this one:

kiran@fosslinux-ubuntu:~$ xdpyinfo | grep dimensions
dimensions: 1200x785 pixels (317x207 millimeters)

Using Byzanz

Use this command to record the entire desktop into a GIF.

byzanz-record --duration=30 --x=0 --y=0 --width=1200 --height=885 desktop.gif

Screenshot Video Capture

Where duration is in seconds and height and weight is specified to capture the entire desktop. Use some values in place of 0 to capture the screenshot with preferable height and width in pixels. This is like exactly same as screen capture by region.

Use ogg, ogv file formats to record video with audio. FLV (Flash Video) is a great format for lossless video capture.

Use the ‘help’ command to know the complete list of commands that you can use with Byzanz.

byzanz-record --help

You should see the complete list of commands as follows:

kiran@fosslinux-ubuntu:~$ byzanz-record --help
 byzanz-record [OPTION…] record your current desktop session

Help Options:
 -?, --help Show help options
 --help-all Show all help options
 --help-gtk Show GTK+ Options

Application Options:
 -d, --duration=SECS Duration of animation (default: 10 seconds)
 -e, --exec=COMMAND Command to execute and time
 --delay=SECS Delay before start (default: 1 second)
 -c, --cursor Record mouse cursor
 -a, --audio Record audio
 -x, --x=PIXEL X coordinate of rectangle to record
 -y, --y=PIXEL Y coordinate of rectangle to record
 -w, --width=PIXEL Width of recording rectangle
 -h, --height=PIXEL Height of recording rectangle
 -v, --verbose Be verbose
 --display=DISPLAY X display to use

That’s it!

Kiran Kumar
Hi there! I'm Kiran Kumar, founder of I'm an avid Linux lover and enjoy hands-on with new promising distros. Currently, I'm using Ubuntu as a daily driver and run several other distros such as Fedora, Solus, Manjaro, Debian, and some new ones on my test PC and virtual machines. I have a day job as an Engineer, and this website is one of my favorite past time activities, especially during Winter ;). When I'm not writing for FOSSLinux, I'm seen biking and hiking on scenic trails. I hope you enjoy using this website as much as I do writing for it. Feedback from readers is something that inspires me to do more and spread Linux love!. If you find a time, drop me an email or feedback from the 'Contact' page. Or simply leave a comment below if you found this article useful. Have a good day!


Please enter your comment!
Please enter your name here




How to install Lightworks on Ubuntu

Even though Linux may not get a native installer of video editing software like Adobe Premiere or Final Cut Pro, that doesn't mean there are no industry standards tools available. Lightworks is non-linear editing (NLE) video mastering app for Windows, Linux, and macOS. Installing it on Ubuntu is simple due to deb package availability.

How to install DaVinci Resolve on Fedora

Davinci Resolve is a professional application used for color correction, video editing, visual effects, and motion graphics. It is one of the extensively used software by movie industries located in Hollywood.

The 10 Best Programming Languages for Hacking

One of the significant entities we have in Cyber Security is Ethical Hacking (ETH). It is the process of detecting and finding flaws or vulnerabilities in a system that a hacker would exploit.

5 Ways to Open a Terminal in Ubuntu

Even though Ubuntu supports many applications with amazing Graphical User Interfaces (GUI), there are always reasons why users prefer using the Terminal to perform different tasks.

How to install Wine on Fedora Workstation

Linux distributions are becoming more and more popular every day, and Fedora Workstation is not left behind. This popularity brings forth the need to run Windows applications on Linux distros like Fedora. Windows has quite some excellent Software that is not available for Linux.

How to download and install iTunes on Linux

iTunes has always been a convenient platform for downloading, organizing, playing, and syncing media between your Apple devices. It also gives users a large pool of media to buy or stream millions of songs using Apple Music.


Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

How to dual-boot Ubuntu and Fedora on your PC

Every Linux distribution has its capabilities and preferences as per the user requirements. That brings forth the need to run different distros on one laptop. For example, a CyberSecurity enthusiast might prefer to use Ubuntu for development and Kali Linux for penetration testing.

5 Things to do when your Linux system GUI freezes

All operating systems freeze at some point and, Linux distributions are no exceptions. In this post, we are going to look at five methods you can apply to your frozen system before thinking of plugging out the power cable or holding down the power button to power off the PC.

VIDEO: Linux Lite 4.8 Features and Desktop Tour

Linux Lite eases Windows 7 users transition to Linux much more comfortable by offering simple software like Team Viewer, VLC, Firefox, TimeShift backup utility, and a full Microsoft Office compatible office suite in LibreOffice.

6 cool and fun Linux commands you don’t want to miss

The real purpose of this article is to help Linux newbies get comfortable and confident with the Linux command-line.  While knowledge and comfort of the Linux GUI allow great power, it is the mastery of the command line, or CLI, affords the Linux user unlimited power and certifies them as a Linux power user well on their way to becoming an expert.