The FEH Command Line Image Viewer

The feh image viewer is a nice little lightweight image viewer which can be run 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.

How to Install FEH

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

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>

Show an Image Without a Border Using FEH

Borderless Image

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

feh -x <nameoffile>

Use FEH as a Slideshow Tool

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

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 backward 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 subfolders 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.

Show an Image and Its Filename Using FEH

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

Displaying an Image Playlist

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 favorite 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>

Show Images as a Montage

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

Open 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 image lists.

Use FEH to Set Your 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 center 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.