open image in terminal

How to Open Image in Terminal

Many system administrators who use Linux systems use terminal for pretty much everything. In such cases, sometimes you may need to display image in terminal or view images in terminal. Since terminal does not have a desktop or GUI it is not possible to directly view images in terminal. In this article, we will look at how to open image in terminal. There are many third-party tools that allow you to do this.


How to Open Image in Terminal

Here are the different tools to open image in terminal.


1. Feh

Feh is a useful tool that you can install on your system to show images in terminal. You can easily install it via terminal.

First, install multiverse repository

$ sudo apt-add-repository multiverse

Next, run the following command to install feh.

$ sudo apt-get install feh

Feh provides multiple image viewing modes, keyboard shortcuts, image captions, terminal input, slideshow, montage, and even multiview.

Now, let us use feh. Here is the syntax to view image using feh.

$ feh filepath

Let us say you have an image at /home/ubuntu/image.jpg. You can view it with the following command.

$ feh /home/ubuntu/image.jpg

It will open the image in a new window. You can hit ‘q’ key to exit from the picture.

Please note, if you only specify the filename instead of full path, feh command will look for the file in your present working directory.

Feh supports numerous options that allows you to avail various features that we had mentioned earlier. For detailed documentation, just type the man command as shown.

$ man feh


2. Viu

Viu is an open source command-line utility that allows you to view various image formats such as .jpg, .png, .gif. It even allows you to display animated gifs, customize image dimensions and transparency. It accepts input through terminal.

Viu uses two image processing protocols – iTerm and Kitty. It is written using Rust programming language. So we will install it using Cargo package manager.

Open terminal and run the following command to install cargo package manager.

$ sudo apt install cargo

Next, run the following command to install viu.

$ cargo install viu

Once it is installed, run viu command without any arguments or options to view all the available options.

$ viu

If you want to open an image file in viu, just enter its name after viu command.

$ viu /home/ubuntu/image.png

It will open the image in a new window. Like feh, if you provide only filename after viu command, then it will look for the file in your present working directory.


3. FIM

FIM (FrameBuffer Improved) is a highly customizable image viewer. It provides many personalization options and features and supports almost every graphic format. It supports keyboard shortcuts, internal variables, aliases, EXIF tag display & orientation, and more.

Also it is purely keyboard based application, so the user does not miss out on anything via menus or buttons that need to be clicked.

Here is the command to install FIM.

$ sudo apt install fim

Here is the command to view all its available options.

$ fim --help

Here is the command to view an image file using fim.

$ fim /home/ubuntu/image.jpg

It will open the image in a new window. Here too, if you mention only the filename, instead of its full path, fim will look for the file in your present working directory.

In this article, we have seen 3 simple and free image viewer tools for opening image files in terminal.

Also read:

Bash Sort By Column
How to Configure PAM in Linux
How to Read Large CSV File in Python
How to Get Filename from Path in Python
How to Increase SSH Connection Timeout

Leave a Reply

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