The Feh image viewer for Linux is a powerful utility that can display your images in a variety of ways. It runs in the X display server from the command line and uses modes to prepare the layout of one or multiple files. If you are looking for a lightweight image viewer that can be accessed from the terminal, Feh is the one for you.
There are a few ways you can install Feh. For major Linux/BSD distributions, use the following commands.
Debian and Ubuntu:
FreeBSD and OpenBSD:
Or you can download the package source with git and use
make install to install the program.
Slideshow mode is Feh’s default operation. When you enter a directory and type
feh into the command line, Feh begins a slideshow of all the images in that directory.
It opens a new window and, beginning with the first recognizable item listed in the directory, displays each image by itself in that new window. You can then flip through the slideshow with your arrow keys. Look what it does for the small list shown here:
The file “cleancat.jpeg” is the first item alphabetically in the “cats” directory, so that’s what Feh placed in its new window. If you were to scroll through the four images in the list, Feh would continue past the final image and start again at the top.
Sometimes Slideshow mode isn’t enough. When you want to see more than one image at once, Feh offers several options beginning with Montage mode.
You can display a montage in a new window by typing
feh -m. This command shows a list of thumbnails that you can either view or save.
If you want thumbnails of a specific size, you can add something like
--thumb-height 150 --thumb-width 200 to your command. Those options will set your thumbnail sizes, respectively, to a height of 50 pixels each and 80 pixels each. Change the height and width pixels as you see fit.
If you want to be exact, you can also pass the
--ignore-aspect parameter to Feh in your command. This will force Feh to ignore the aspect ratio of your image and conform to the specific height and width you set with the previous parameters.
You can also change the height and width of your entire montage by specifying
--limit-height pixels and
--limit-width pixels in your command.
Index mode provides a little more detail than Montage does. It also displays a collection of your images’ thumbnails, but it places file names and other descriptions below each image.
feh -i will give you the following as a default printing.
If you want to be more specific with your descriptions, you can use the
--index-info operator as seen in the following image.
feh -i --index-info '%hx%w-%n' shows the height (%h), width (%w), and file name (%n) as the description. You can find the full list of descriptors in the Feh man page by typing
man feh into your terminal and searching for “FORMAT SPECIFIERS” with
/ after the manual opens.
Thumbnail mode looks identical to Index mode, and it accepts the same parameters discussed above. Its only difference is that you can click any thumbnail and open that respective image in a new window.
Enter Thumbnail mode with
Multiwindow mode allows you to open all the files in your directory in separate windows.
Try it with
feh -w. See the result below:
You can see from this screenshot that using Multiwindow mode in a tiling window manager can get crowded quickly. Even if you use a non-tiling window manager, a large directory can easily fill your screen. Use caution when opening more than a dozen files with Feh in this manner.
Feh can act as more than just an image viewer. List mode bears part of that capability.
feh -l gives you the sort of output you see below.
When you use list mode you will see an output similar to the
ls command. The screenshot above shows how similar those commands are.
List mode surpasses ls, however, by making it easy to see format, height and width, and pixels of each image in your directory.
Now you should have the knowledge necessary to tear through a few image directories of your own. Play around with the various parameters presented here, and make sure to take advantage of Feh’s graphical and list-making capabilities as you go.