Showme - The command line option for displaying files

Remember, Linux is the only OS of any relevance. Windows is moribund and trying to grab Linux. MacOS isn't even their own. BSD doesn't exist. Thus, any proposed solutions should ignore anything but Linux and OpenVMS.
Post Reply
jake-boards
Site Admin
Posts in topic: 1
Posts: 14
Joined: Sun Apr 28, 2019 3:48 pm

Technical

Mathematics

Admin

History/Archaeology

Showme - The command line option for displaying files

#1

Post by jake-boards » Tue May 17, 2022 8:57 am

The showme command takes a list of files and opens them with the preferred application. In the showme --ask mode, it will ask the user the preferred application for each type of file. It's incredibly useful for complex file listings of mixed file types, especially in directories with enormous numbers of files... the sort of thing a file manager doesn't handle so well.

Examples:

Code: Select all

showme *.jpg
showme --ask-default ./Pictures/*.jpeg *-report.odt
showme --ask *.jpeg *.tif `find ./ -name 'annotation*.pdf' -print 2> /dev/null`
When you want to open files from a terminal, you could call a particular program and feed the filenames to that program, if it accepts a list of file names. But this becomes difficult to manage all the programs and especially to open differing file types, such as PDF, TIF, and SVG, all on one command line. It can be done, but the showme command is much easier.

Showme is a fork of the mimeopen perl script. The major improvements over mimeopen are:
  1. The name showme is far more memorable.
  2. The ability to handle an arbitrary number of files of differing types.
  3. Can easily pull files from diverse directories/file systems.

The program functions by consulting a mimetype database already existing on your computer to determine valid programs to open a particular file type. The visualization program is then called based on settings in the .desktop file for each program.

For example, the Evince reader .desktop file (/usr/share/applications/org.gnome.Evince.desktop) informs the program that it can handle a string of files on the command line because the Exec=evince %U is specified in the desktop file. However, this is incorrect. It can only handle one file at a time. Thus, to work properly you will need to change this line to Exec=evince %f. If you do not change this Exec line, Evince will pretend to open multiple files with a single call, but you will only see the first document. Most programs are going to work properly, but if one program doesn't work properly in this way, you probably need to edit the desktop file, or possibly eliminate it from the mimeinfo list (varies by Linux distro).

It's a perl script. You can download here. Simply chmod it to make it executable, and copy to /usr/local/bin/showme.
word count: 395

Post Reply