How to Open GNOME Image Viewer via the Terminal

If you prefer using a CLI prompt, then you might want to open images for viewing via the terminal rather than clicking on them in a file manager. Knowing how to do this is also useful if you needed to add this functionality in a script. How to open an image viewer is largely dependent on which packages you installed when configuring Linux.

Users of desktop environments other than GNOME can also access similar image viewers from the terminal using slightly modified commands. While GNOME is the default desktop environment for Fedora, other popular Linux distributions like Ubuntu and Slackware feature other defaults.

Method 1: Using Eye of Gnome or Mate

If you have the basic Eye of Gnome package that comes with GNOME2 installed, then you can simply type eog theFile at the command prompt. Replace theFile with the name of the file you were looking for. You can access it via an absolute path if you needed to, hence a command like eog /home/user/Pictures/bigPicturePath.jpg would work. If there are spaces in the name, then simply put quotation marks around it. If you alternatively have the Eye of Mate package installed, then you should replace eog with eom in the command, but everything else should be the same.

Method 2: Using gnome-open or xdg-open

You can also issue the command gnome-open theFile.jpg with whatever file name you’d like to open up an image in your default image viewer. This will actually work with any file, since gnome-open will open a file with whatever it believes the preferred application will be.

If you’re not using GNOME at all, you can accomplish the same with xdg-open, which should actually also work on GNOME desktops. If you merely type xdg-open theFile.jpg, replacing this once more with the file name in question, then this accesses the preferred application for a specific file. It supports several different desktop environments, and works even if you changed the image viewer.

Users of Xfce4 can also use exo-open fileName.jpg to accomplish the same. The xdg-open program calls this, and it calls pcmanfm $1 on LXDE. It calls kde-open “$1” on KDE Plasma installations, which these users may also wish to use.

Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to Open GNOME Image Viewer via the Terminal

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested