The feh Command Line Image Viewer

Introduction

The feh image viewer is a nice little lightweight image viewer which can be ran from the command line. It is very useful as a way of adding a wallpaper to a desktop such as Openbox or Fluxbox.

It is a no frills affair but great for people who like to use the minimum amount of resource.

This guide shows some of the features of feh.

1
How To Install feh

The feh Image Viewer
The feh Image Viewer.

To install feh open a terminal window and depending on your distribution run one of the following commands.

For Debian and Ubuntu based distributions use apt-get as follows:

sudo apt-get install feh

For Fedora and CentOS based distributions use yum as follows:

sudo yum install feh

For openSUSE use zypper as follows: 

sudo zypper install feh

Finally for Arch based distributions use pacman as follows:

sudo apt-get install feh

2
Show An Image With feh

Show An Image With feh
Show An Image With feh.

To show an image with feh open a terminal window and navigate to a folder with pictures.

For example use the following cd command:

cd ~/Pictures

To open an individual picture type the following:

feh <nameoffile>

 To change the dimensions of the image use the following command:

feh -g 400x400 <nameoffile>

 

 

3
Show An Image Without A Border Using feh

Borderless Image
Borderless Image.

 You can show the picture without a border by using the following command:

feh -x <nameoffile>

4
Use feh As A Slideshow Tool

feh Slideshow
feh Slideshow.

You don't need to specify an image name to use feh. You can simply navigate to a folder which contains images and run the feh command with no switches and no parameters.

For example:

cd ~/Pictures
feh

The first image in the folder will be displayed. You can scroll through all the images by pressing the right arrow key or the space bar.

You can scroll backwards by pressing the left arrow.

By default feh will continue to loop around all the pictures in the slideshow but you can get it to stop after the last image by using the following command:

feh --cycle-once

You can get feh to search down through sub folders by using the following command:

feh -r

You can also show the images in a random order by using the following command:

feh -z

Maybe you want to see the images in reverse order. To do so use the following command:

feh -n

You can add a delay between each image so that it switches automatically as follows:

feh -Dn

Replace n with the number of seconds to delay.

5
Show An Image And Its Filename Using feh

Show Image And Filename
Show Image And Filename.

You can get feh to show both the image and the name of the file.

To do so use the following command:

feh -d

If the images have a light background it is sometimes difficult to see the filename.

To get around this you can use the following command which displays the text on a tinted background.

feh -d --draw-tinted

6
Displaying An Image Playlist

Show Imagelist Using feh
Show Imagelist Using feh.

 You can specify a list of images to be used by feh as part of a slideshow.

To do so open a file using your favourite editor such as nano.

Within the file enter the path to an image on each line of the editor.

When you have finished save the file.

To show the image list run the following command:

feh -f <imagelistname>

If you want to hide the pointer because you are showing a slideshow use the following command:

feh -Y -f <imagelistname>

7
Show Images As A Montage

feh Montage Mode
feh Montage Mode.

 feh has something called montage mode which takes all the images in a list or slideshow and creates one single image using thumbnails.

To enable montage mode enter the following command:

feh -m

8
Open Each Image In A New Window

Each Image In A New Window
Each Image In A New Window.

 If you don't want to view a slideshow but you want to open all the images in a folder in its own window you can use the following command:

feh -w

This works with folders and imagelists.

9
Use feh To Set Your Wallpaper Background

Use feh To Set Wallpaper Background
Use feh To Set Wallpaper Background.

feh is best as a tool to set the background wallpaper as part of a lightweight desktop setup.

To get feh to set the background run the following command:

~/.fehbg <pathtoimage>

This guide shows how to add feh to your autostart file in Openbox so that the wallpaper loads every time the window manager starts. 

If the image isn't the correct size you have various options for positioning the image as follows:

~/.fehbg --bg-center <pathtoimage>

This will centre the image and if it is too small a black border will be displayed

~/.fehbg --bg-fill <pathtoimage>

This will continue expanding the image until it fits the screen. The aspect ratio is maintained so part of the image will be truncated.

~/.fehbg --bg-max <pathtoimage>

This will expand the image but will stop when either the width or height touches the edge of the screen. A black border will be placed around the missing bits.

~/.fehbg --bg-scale <pathtoimage>

This option will stretch the image. The aspect ratio is not maintained.

More From Us