Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The terminal is very fast and convenient way to quickly access directories and files (faster than find and click on the directory).

One thing that it cannot show in text-mode is "pictures".

What is a best way to view pictures (like you see images thumbnail in Nautilus) when you are working in the terminal (e.g. command nautilus or any program - but should be fast and convenient)?

share|improve this question
    
    
I just run a terminal emulator under my desktop enviroment. So you have the advantages of both at hand. – vonbrand Mar 23 '14 at 16:05
    
Gotta object to the close votes here as there is a substantial difference between the need to view images files from a (presumably GUI) terminal (this question) and the need to view them on the console (the other question). – goldilocks Mar 23 '14 at 19:50
    
I provide a list of pretty much all your options here in this Q&A: How to get JPEG thumbnails quickly – slm Mar 24 '14 at 2:17
    
how to do it from inside the terminal askubuntu.com/questions/97542/… – Ciro Santilli 巴拿馬文件 六四事件 法轮功 Mar 21 at 15:37

13 Answers 13

The way to "double-click" on a file from the command line is xdg-open.

If you're on Gnome (probably, if you're using Nautilus), you can use eog directly, or any other image program (feh is quite good).

share|improve this answer
1  
feh is amazing! – Searene Dec 11 '15 at 6:26
    
feh even works with multiple URLs! – Serge Stroobandt May 21 at 15:16

If you happen to have installed imagemagick, you can use its very handy display command-line tool.

display path/to/picture.png
share|improve this answer
1  
I personally prefer feh, but display is usually installed on web servers, where feh or other image browsers aren't installed. – pevik Dec 7 '14 at 19:34

I usually run python -m SimpleHTTPServer 8080 from a folder containing the image and view it at localhost:8080/path/to/image.jpg. Works great to browse and look at different image and text files in that same directory.

Edit: This method also works for remote boxes. Just run the python server as above, and if the ports are open you can connect to myserver.com:8080/path/to/image.jpg. If the server does not expose ports, you can set up an ssh tunnel with ssh me@myserver.com -N -L localhost:8080:localhost:8080 and then view the images from your local browser at localhost:8080/path/to/image.jpg. Note this http interface is much faster than ssh -X.

share|improve this answer
5  
Clever! Works like a charm and there's no need to type /path/to/image.jpg. Just open localhost:8080 and click on the filenames. – Roger Dahl Mar 5 '15 at 4:49
    
Regarding the last paragraph, you can also add tunnels easily using PuTTY configuration! Then you can access it through a browser. Awesome! – ADTC Oct 30 '15 at 8:45

I guess feh would be the one you are looking for.

Although popping out a terminal-like window for picture display as mplayer does for video playing, Feh is still considered as a terminal-based picture viewer due to its command-intensive control style.

share|improve this answer

If you're in pure terminal with framebuffer activated, I'd recommend fbi. It's always in my after-install to do list.

Otherwise, eog is the default picture opener in Gnome, as Kevin mentioned. Also, Shotwell seems to open pretty fast for me... I'm pretty sure there are hundreds. :-)

share|improve this answer
    
Thanks for this one - it's news to me. As an aside, googling lands me at fim's (self-styled framebuffer image viewer improved ) manpage only a few search results in. Dont know yet the difference. – mikeserv Mar 23 '14 at 6:42

w3m's imgdisplay library is able to display images directly. It only works on some terminal emulators such as Xterm and URxvt.

ranger is a file browser that makes use of the library to display previews. Add this to ranger's configuration file to enable the feature:

set preview_images true
share|improve this answer

If you're on OS X, iTerm 2 supports displaying inline images:

iTerm2 inline image

As you can imagine, this can be highly useful when you just want to display an image without going in and opening up Preview.app or having to open the Finder to the image and hitting spacebar on the image.

The feature is documented at iTerm2's feature page

share|improve this answer

Another great terminal-based picture viewer is fim, which is a improved fbi with a vim-like control system.

share|improve this answer

In linux you can install gnome-open.

# In Debian flavors

sudo apt-get install gnome-open

Then create an alias:

alias open='gnome-open'

Then you can:

open file.pdf
open file.jpg
etc
share|improve this answer
    
This was installed by default in my Ubuntu install. – starbeamrainbowlabs Mar 12 at 11:02

If using gnome it is as simple as typing

$ gnome-open /path/to/photo

and it opens the image using the default image viewer that you have in your machine.

share|improve this answer
1  
Already posted a few months ago: unix.stackexchange.com/a/248179/70524 – muru Apr 4 at 10:52

This is a 4 year-old-question but I found that people still look at it. So, today I would like to answer my own question specifically only for iTerm2.

At first time I asked this question. The term of "fastest" I was thinking of viewing image as fast as cat command displaying text. So, today I found the answer on iTerm2, which are the two handy commands name imgcat and imgls.

To use them, the first let's install iterm2-nigthly:

$ brew cask install iterm2-nightly

then visit the website:

https://github.com/olivere/iterm2-imagetools

and install imgcat and imgls commands:

$ go install github.com/olivere/iterm2-imagetools/cmd/imgcat
$ go install github.com/olivere/iterm2-imagetools/cmd/imgls

So, I really love them and also hope this will be useful for you all!

share|improve this answer

From the terminal? Why not in the terminal: cacaview might be the fastest. By default it's fastest if the terminal has no graphics.

In Debian: sudo apt-get install caca-utils

share|improve this answer

I just found this page, and it is still very relevant today. OP didn't really specify if they want X or fb viewer.

I use a small utility called pho: http://www.shallowsky.com/software/pho/

Needs X, so call from command line in a terminal window. Views many picture formats, gif and jpg for sure... some others as well.

Can do wildcard globbing from command line: eg. "$ pho img00??.jpg" will view all files that match in order. Space goes forward through list and backspace goes back. Its quick loading individual images -- hold down space and you fly through them.

Very fast if you want to look through a bunch of pictures, flag ones of interest, rotate, delete unwanted... I keep coming back to it.

From the web page above:

pho (pronounced like the first syllable in "photo") is a lightweight program for viewing large numbers of images quickly, rotating or deleting some, and making notes about what to do with each image -- for instance, for going through hundreds of images after uploading them from a digital camera.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.