Did you know our brain interprets images much more swiftly compared to text? Well, Digital media is one of the key elements of computer systems now. Being a Linux user, I try to perform most of the operations through the terminal using commands. The majority of the tasks in the terminal are text-based; I can read, edit text files, but I had no idea how to display images in the terminal. Is it even possible to view images while using the terminal? Well, luckily, the answer is yes! Images can appear in the terminal using commands.

There are various GUI-based applications in Linux distributions to view images, but many Linux users prefer to work with the terminal. This guide is going to mention few techniques to display images in the terminal. These methods would be quite helpful for those who are searching for CLI (Command Line Interface) based applications to view images.  So, let’s begin:

How to display images in terminal through FIM

The first method to view pictures in the terminal is FIM, an open-source, highly customizable image viewer application. FIM represents Fbi IMproved, and Fbi is “frame buffer image viewer” in Linux. FIM is lightweight compared to many GUI-based applications and comes with various shortcut keys to control images. Common file formats FIM supports are jpeg, png, gif, ppm, tiff, and xwd. To install it, use the commands mentioned below:

For Ubuntu and Debian based distros, FIM can be installed using:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-01.png" data-lazy- height="268" src="data:image/svg xml,” width=”974″>

The syntax to display image in terminal is:

Now, to display the image in the terminal, use:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-02.png" data-lazy- height="647" src="data:image/svg xml,” width=”974″>

To display all the images of the same extension, use:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-03.png" data-lazy- height="564" src="data:image/svg xml,” width=”974″>

The keyboard shortcuts to control image are listed below:

  • Image Navigation : PageUp & PageDown or “Enter”
  • Zoom :
  • Autoscale: a
  • Fitting width and height: wh
  • Flip: f
  • Mirror: m
  • Rotate (clockwise) : r
  • Rotate (anti-clockwise) : R
  • To quit FIM, press the “Esc” or “q” key.

How to display images in terminal using ImageMagick

Most Linux users are aware of the “ImageMagic” utility. It is a lightweight application to manipulate images of hundreds of formats, including jpeg, png, gif, pdf, svg, etc. It can even convert the images from one format to another.

But many of us don’t know that there is a command associated with this app called the “display” command. Using the “display” command, you can view the image in the terminal. To install it, use the below-mentioned commands:

For Ubuntu/Debian based distros:

$sudo apt install ImageMagick

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-04.png" data-lazy- height="222" src="data:image/svg xml,” width=”974″>

For CentOS 8, Red Hat (RHEL), and Fedora:

$sudo dnf install -y ImageMagick ImageMagick-devel

For OpenSUSE:

$sudo zipper install -y ImageMagick

To display an image in terminal use:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-05.png" data-lazy- height="685" src="data:image/svg xml,” width=”974″>

And to close the image, press the “Esc” or “q” key. To specify the size of the images, use the “-geometry” option with the “display” command:

$display -geometry 600×400 image1.jpg

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-06.png" data-lazy- height="520" src="data:image/svg xml,” width=”974″>

To manipulate the size of the image, use the “-resize” option:

$display -resize 800×500 image1.jpg

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-07.png" data-lazy- height="585" src="data:image/svg xml,” width=”974″>

Or use “%” sign with “-resize” flag:

$display -resize 60% image1.jpg

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-08.png" data-lazy- height="637" src="data:image/svg xml,” width=”974″>

How to display images in terminal using feh

“Feh” is another lightweight image viewer application designed to view images in the terminal. It not only displays images from your local drive but also from the internet through URLs. You can browse images in various forms such as montages, slideshows, thumbnails, etc. To install it on Linux, use the commands listed below:

For Ubuntu and Debian based distros:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-09.png" data-lazy- height="270" src="data:image/svg xml,” width=”974″>

To install it on Arch Linux:

To install it on FreeBSD and OpenBSD:

Once the installation is done, you can view the image using the command given below; I am displaying “image1.jpg” from the “Downloads” directory:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-10.png" data-lazy- height="660" src="data:image/svg xml,” width=”974″>

To run a slideshow, open the terminal in the directory containing images and execute:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-11.png" data-lazy- height="677" src="data:image/svg xml,” width=”974″>

To navigate images, use “left/right” arrow keys and zoom in and zoom out using “up/down” keys. To view more than one image on the screen, especially in montage format, use the “-m” (montage) option:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-12.png" data-lazy- height="350" src="data:image/svg xml,” width=”974″>

To open multiple images in multiple windows, use:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-13.png" data-lazy- height="704" src="data:image/svg xml,” width=”974″>

To quit, simply press the “Esc” key.

How to display images in terminal using Terminology

Images can also be viewed in a terminal emulator called “Terminology.” This feature-rich terminal emulator not only displays images in the terminal but also plays videos in it. To install it on Ubuntu and Debian based distributions, use:

$sudo apt install terminology

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-14.png" data-lazy- height="237" src="data:image/svg xml,” width=”974″>

To install it on Arch Linux:

$sudo pacman -S terminology

To install it on Fedora, use: 

$sudo dnf install terminology

For OpenSUSE, execute:

$sudo zypper install terminology

And to view to image, follow the syntax:

For instance:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/Display-image-Linux-terminal-15.png" data-lazy- height="643" src="data:image/svg xml,” width=”974″>

To play video, use:

Terminology is one of the well-known terminal emulators and comes with tons of features and customization options.

Conclusion

Viewing digital media such as images/animated gifs in the terminal can be much more convenient for Linux users who spend most of their time working with the terminal. It can be helpful in various ways. We discussed four different approaches to display images in the terminal. But other utilities can help display images in the terminal, such as w3m, viu, and eog (eye of gnome). The terminal is an effective way to communicate with your system, and displaying digital media in the terminal enhances its functionality and helps the terminal users work more efficiently.