Skip to content

Instantly share code, notes, and snippets.

@vbz-repo
Last active August 18, 2025 01:28
Show Gist options
  • Select an option

  • Save vbz-repo/3282729d09067611838067e43dfb21c3 to your computer and use it in GitHub Desktop.

Select an option

Save vbz-repo/3282729d09067611838067e43dfb21c3 to your computer and use it in GitHub Desktop.
feh command line with examples

feh command line with examples

feh is an X11 image viewer aimed mostly at console users. Unlike most other viewers, it does not have a fancy GUI, but simply displays images.
It is controlled via commandline arguments and configurable key/mouse actions.

-- feh website

Slideshow mode

-F, --fullscreen
Window fullscreen mode.
-S, --sort sort_type
Sort file list according to image parameters (name, filename, dirname, mtime, width, height, pixels, size, format).
--version-sort
Natural sorting for file and directory names (e.g. "2.jpg" comes before "10.jpg").
--info [flag]command_line
Execute command_line and display its output in the bottom left corner of the image.
-d, --draw-filename
Draw the file name at the top-left of the image.
--draw-exif
Display some EXIF information in the bottom left corner.
--draw-tinted
Show overlay texts on a semi-transparent background to improve their readability.
-B, --image-bg style
Background for transparent image parts and the like.
--auto-rotate
Automatically rotate images based on EXIF data. Does not alter the image files.
-p, --preload
Preload images. This also analyses the images to get data for use in sorting, such as pixel size, type etc.

feh -F -S filename --version-sort --info "echo 'Dimensions: %wx%h, Zoom: %z'" -d --draw-exif --draw-tinted -B "#313131" --auto-rotate -p ./images-directory

Montage mode

-m, --montage
Enable montage mode.
-X, --ignore-aspect
Ignore the aspect ratio of images. This will prevent any empty space in the final montage.
-W, --limit-width pixels
Limit the width of the montage, defaults to 800 pixels.
-H, --limit-height pixels
Limit the height of the montage.
-y, --thumb-width pixels
Set thumbnail width.
-E, --thumb-height pixels
Set thumbnail height.
-o, --output file
Save the created montage to file.

feh -m -X -W 800 -H 405 -y 400 -E 400 -o image-file-03 -S filename --version-sort -B "white" --auto-rotate image-file-01 image-file-02

Input example

feh-cli-example-01.jpg
feh-cli-example-02.jpg

Output example

feh-cli-example-03.jpg

Index mode

-i, --index
Enable Index mode.
Index mode is similar to montage mode, and accepts the same options.
--index-info format
Show image information based on format below thumbnails in index / thumbnail mode.
See format specifiers in the feh manpage.

feh -i -X -W 1476 -y 164 -E 164 --index-info "%n\nSize: %S\nDim: %wx%h\nPixels: %p (%P)" -S filename --version-sort -B "white" --auto-rotate -p ./images-directory

feh-cli-example-04.jpg

Thumbnail mode

-t, --thumbnails
Same as Index mode, but the thumbnails are clickable image launchers.
Note that --info, -d, --draw-exif, --draw-tinted do not affect the thumbnail window.
However, they work for image windows launched from thumbnail mode.

feh -t -W 1476 -y 164 -E 164 -S filename --version-sort --index-info "%n\nSize: %S\nDim: %wx%h\nPixels: %p (%P)" --info "echo 'Dimensions: %wx%h, Zoom: %z'" -d --draw-exif --draw-tinted -B "#313131" --auto-rotate -p ./images-directory

Multiwindow mode

-w, --multiwindow
Disable slideshow mode. This setting will open multiple windows, one per file.
Don't use it with a large file list!
-g, --geometry width x height | + x + y | width x height + x + y
Use a fixed window size as specified in the X-style geometry string, e.g. 640x480.
An optional +x+y window offset can be specified.
-., --scale-down
Scale images to fit window geometry (defaults to screen size when no geometry was specified).

feh -w -g 800x800 --scale-down -S filename --version-sort --info "echo 'Dimensions: %wx%h, Zoom: %z'" --draw-exif --draw-tinted -B "#313131" --auto-rotate -p ./images-directory/image-file-0?.{jpg,png}

feh-cli-example-05.jpg

List mode

-l, --list
Don't display images. Analyze them and display an ls - style listing.

feh -l -S filename --version-sort ./images-directory
$ feh -l -S filename --version-sort ./_work/ready/feh-cli-example-0*
NUM FORMAT  WIDTH   HEIGHT  PIXELS  SIZE    ALPHA   FILENAME
1   jpg     400     400     160k    102k    -       ./_work/ready/feh-cli-example-01.jpg
2   jpg     400     400     160k    114k    -       ./_work/ready/feh-cli-example-02.jpg
3   jpg     800     405     324k    89k     -       ./_work/ready/feh-cli-example-03.jpg
4   png     822     517     425k    301k    X       ./_work/ready/feh-cli-example-04.png
5   png     800     424     339k    283k    -       ./_work/ready/feh-cli-example-05.png

Resources

manual page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment